dot

packages and services management
Log | Files | Refs | README

commit 1b1d50b5551c453ecf03fcb3db87ebd1cd6fa489
parent 0004dec5aa5e4902fac9317556896a9f0f0d4bac
Author: Josuah Demangeon⠠⠵ <mail@josuah.net>
Date:   Wed,  8 Mar 2017 19:33:20 +0100

Removed shebands

Diffstat:
M.profile | 26++++++++++----------------
Mbin/adagio | 1-
Mbin/blawk | 1-
Mbin/calendar | 4++--
Mbin/dna | 1-
Mbin/drawk | 11+++--------
Mbin/fig1 | 1-
Mbin/fig2 | 1-
Dbin/git-prompt | 46----------------------------------------------
Abin/git-pwd | 48++++++++++++++++++++++++++++++++++++++++++++++++
Mbin/gix | 1-
Mbin/ii-client | 1-
Mbin/ii-filter | 2--
Mbin/ii-filter2 | 19++++++++++++++++++-
Mbin/ii-server | 1-
Mbin/index | 2+-
Mbin/irc | 3+--
Mbin/lightsaber | 1-
Mbin/mfilter | 2+-
Mbin/music-rename | 1-
Mbin/play | 1-
Mbin/status | 1-
Mbin/tty-theme | 2+-
Mbin/updd | 3+--
Mbin/version | 1-
Mbin/www | 1-
26 files changed, 86 insertions(+), 96 deletions(-)

diff --git a/.profile b/.profile @@ -1,4 +1,3 @@ -#!/bin/sh # Shell configuration for any POSIX shells @@ -26,20 +25,22 @@ export PAGER='less' MANPAGER='less -R' DVTM_PAGER='less -R' # prompt export PS1='$( - [ "$?" -gt 0 ] && color="1" || color="7" - [ "${PWD##$HOME*}" ] && pwd="$PWD" || pwd="~${PWD#$HOME}" || pwd + [ "$?" -gt 0 ] && color="1" || if git rev-parse 2>/dev/null + then [ "$(git status -s)" ] && color="3" || color="2" + fi + [ "$SSH_CONNECTION" ] && host=" $(hostname)" - printf "\033[?6c" # TTY cursor shape - printf "\033]0;%s\007" "$pwd" # terminal name - printf "\n%s%s \033[1;3%dm•\033[m%s " "$host" "$(git-prompt)" "$color" + printf "\033[?6c" + printf "\033]0;%s\007" "$(git-pwd)" # terminal name + printf "\n%s \033[1;3%dm•\033[m%s " "$host" "${color:-7}" )' export PS2=': ' export PS3=': ' # core -alias p='[ "${PWD##$HOME*}" ] && pwd || printf "~%s\n" "${PWD#$HOME}"' +alias p='git-pwd' alias l='ls -lhp' alias la='ls -lhpA' alias cl='printf "\033[H\033[2J"' @@ -88,9 +89,7 @@ extract() } -# set screen brightness, using sudo - -light() +brightness() { printf %s "$1" | sudo tee -a "$( find -L /sys/class/backlight -maxdepth 2 -name brightness @@ -98,8 +97,6 @@ light() } -# works only in TTY and with sudo, unfortunately - rotate() { case "$1" in @@ -108,9 +105,7 @@ rotate() } -# frameBuffer video player based on mplayer - -fbv() +fbvideo() { mplayer -vm -vo fbdev2 "$1" -vf scale -zoom -x "$( sed 's/,.*//' /sys/class/graphics/fb0/virtual_size @@ -138,7 +133,6 @@ rfc() } - main() { if [ "$TERM" = 'linux' ] diff --git a/bin/adagio b/bin/adagio @@ -1,4 +1,3 @@ -#!/bin/sh # Albinoni, Adagio fog G minor adapted to 'beep' diff --git a/bin/blawk b/bin/blawk @@ -1,4 +1,3 @@ -#!/bin/awk -f # draw an image using block characters # USAGE: diff --git a/bin/calendar b/bin/calendar @@ -1,4 +1,4 @@ -#!/usr/bin/awk -f +awk ' # command line calendar (WIP) function is_bissextile(year) { @@ -27,4 +27,4 @@ function to_seconds(year, month, day, hour, minute, second) day += 365 + is_bissextile(year); return (second + 60 * (minute + 60 * (hour + (24 * (day - 1))))); -} +}' diff --git a/bin/dna b/bin/dna @@ -1,4 +1,3 @@ -#!/bin/sh # prints nucleotides with full structure, sequentially # Usage: dna [ATCG]... diff --git a/bin/drawk b/bin/drawk @@ -1,9 +1,4 @@ -#!/usr/bin/awk -f -# | | -# .--| .,-- ,--. , , , | / -# | | | ,--| | | | |-< -# `--` ' `--` `-'-' ' ` 2016-10-07 -#------------------------------------------------------------------------------- +awk ' # Drawille implementation in awk # # USAGE: @@ -37,7 +32,7 @@ BEGIN { # Remove spaces gsub(" ", "", lines); - # Split lines according to the image width 'x' + # Split lines according to the image width x for (j = 0; j * x < length(lines); j++) { line[j] = substr(lines, j * x, x); } @@ -59,4 +54,4 @@ BEGIN { } print "" } -} +}' diff --git a/bin/fig1 b/bin/fig1 @@ -1,4 +1,3 @@ -#!/bin/sh # figlet without all the bells and fanciness. if [ $# = 0 ] diff --git a/bin/fig2 b/bin/fig2 @@ -1,4 +1,3 @@ -#!/bin/sh # figlet without all the bells and fanciness. if [ $# = 0 ] diff --git a/bin/git-prompt b/bin/git-prompt @@ -1,46 +0,0 @@ -#!/bin/sh - -git rev-parse 2> /dev/null && git status --porcelain -b | awk ' -/^## / { - branch = $0; - sub(/^## /, "", branch); - sub(/\.\.\..*/, "", branch); - - if ($0 ~ /ahead /) { - ahead = $0; - sub(/.*ahead /, "", ahead); - sub(/\].*|, .*/, "", ahead); - } - - if ($0 ~ /behind /) { - behind = $0; - sub(/.*behind /, "", behind); - sub(/\].*|, .*/, "", behind); - } - - next; -} - -/^\?\? / { untracked++; next; } -/^U. / { conflicts++; next; } -/^.U / { conflicts++; next; } -/^DD / { conflicts++; next; } -/^AA / { conflicts++; next; } -/^.M / { changed++; } -/^.D / { changed++; } -/^[^ ]. / { staged++; } - -END { - printf(" %s", branch); - - if (untracked + conflicts + changed + staged + behind + ahead == 0) { - printf " \033[32mok\033[0m"; - } else { - if (untracked) printf " \033[33m?\033[m%d", untracked; - if (conflicts) printf " \033[31m!\033[m%d", conflicts; - if (changed ) printf " \033[32m+\033[m%d", changed ; - if (staged ) printf " \033[34m*\033[m%d", staged ; - if (behind ) printf " \033[31m↓\033[m%d", behind ; - if (ahead ) printf " \033[36m↑\033[m%d", ahead ; - } -}' diff --git a/bin/git-pwd b/bin/git-pwd @@ -0,0 +1,48 @@ +[ "${PWD##$HOME*}" ] && printf %s "$PWD" || printf ~%s "${PWD#$HOME}" + +git rev-parse 2> /dev/null && git status --porcelain -b | awk ' +/^## / { + branch = $0; + sub(/^## /, "", branch); + sub(/\.\.\..*/, "", branch); + + if ($0 ~ /ahead /) { + ahead = $0; + sub(/.*ahead /, "", ahead); + sub(/\].*|, .*/, "", ahead); + } + + if ($0 ~ /behind /) { + behind = $0; + sub(/.*behind /, "", behind); + sub(/\].*|, .*/, "", behind); + } + + next; +} + +/^\?\? / { untracked++; next; } +/^U. / { conflicts++; next; } +/^.U / { conflicts++; next; } +/^DD / { conflicts++; next; } +/^AA / { conflicts++; next; } +/^.M / { changed++; } +/^.D / { changed++; } +/^[^ ]. / { staged++; } + +END { + printf(" %s", branch); + + if (untracked + conflicts + changed + staged + behind + ahead == 0) { + printf " ok"; + } else { + if (untracked) printf " ?%d", untracked; + if (conflicts) printf " !%d", conflicts; + if (changed ) printf " +%d", changed; + if (staged ) printf " *%d", staged; + if (behind ) printf " ↓%d", behind; + if (ahead ) printf " ↑%d", ahead; + } +}' + +printf '\n' diff --git a/bin/gix b/bin/gix @@ -1,4 +1,3 @@ -#!/bin/sh # Static Git index generator inspired from git.2f30.org/stagit diff --git a/bin/ii-client b/bin/ii-client @@ -1,4 +1,3 @@ -#!/bin/sh # wrapper script for ii irc client http://tools.suckless.org/ii diff --git a/bin/ii-filter b/bin/ii-filter @@ -1,5 +1,3 @@ -#!/bin/sh - busybox awk -v COLS="${1:-80}" 'BEGIN { NICK_COL = 14; TEXT_COL = COLS - NICK_COL - length(" | "); diff --git a/bin/ii-filter2 b/bin/ii-filter2 @@ -1,9 +1,13 @@ -#!/bin/sed -rf +sed -r ' + # Remove date + s/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2} // + # Chat events + s/^-!- (.*)\(([^)]*)\) has joined .*/<\1>\x1b[0;1;32m>\x1b[0m \x1b[37m\2\x1b[0m/ s/^-!- (.*)\(([^)]*)\) has left .*/<\1>\x1b[0;1;31m<\x1b[0m \x1b[37m\2\x1b[0m/ s/^-!- (.*) changed mode\/.* -> (.*)/<\1>\x1b[0;1;34m=\x1b[0m \2\x1b[0m/ @@ -14,27 +18,40 @@ s/^\+(.*)/ \x1b[0;1;33m+\x1b[0m \1/ s/^-!- (.*)/ \x1b[0m│\x1b[1;33m \1\x1b[0m/ s/^\*\*\* (.*)/ \x1b[0m│ \x1b[37m\1\x1b[0m/ + # Infos + s/^-!- (.*)/ \x1b[0m│ \x1b[37m\1\x1b[0m/ + # Motd + s/^- (.*)/\x1b[0m │ \x1b[37m\1\x1b[0m/ s/End of \/MOTD command./\x1b[0m └───────────────┬──────────────────────────────────┤ MOTD/ + # Names + s/ End of \/NAMES list\./\n\x1b[0m──────────────────┬──────────────────────────────────┤ NAMES/ + # Right alignment + /<[^>]*>/ { :x s/^([^>]{0,16}>.*)$/ \1/g tx } + # Nicks + s/( *)<([^>]*)> .ACTION (.*)/\x1b[0m\1 \x1b[1m\2\x1b[0m ┊ \x1b[35m\3\x1b[0m/ s/( *)<([^>]*)> ([^ :]*): /\x1b[0m\1 \x1b[1m\2\x1b[0m ┊ \x1b[1;36m\3:\x1b[0m / s/( *)<([^>]*)> /\x1b[0m\1 \x1b[1m\2\x1b[0m ┊ / + # Clean remaining < .* > + s/^( *)<([^>]*)>/\x1b[0m\1 \x1b[1m\2\x1b[0m / +' diff --git a/bin/ii-server b/bin/ii-server @@ -1,4 +1,3 @@ -#!/bin/sh # connect to my irc server and channels printf 'Password: ' diff --git a/bin/index b/bin/index @@ -1,4 +1,4 @@ -#!/bin/sh +# generate an index for my website printf '<!DOCTYPE html> diff --git a/bin/irc b/bin/irc @@ -1,6 +1,5 @@ -#!/bin/sh # Irc client in less than 300 lines of shell script -# + # With help of http://xero.nu, inspired by http://tools.suckless.org/ii NICK="${NICK-$(whoami)}" diff --git a/bin/lightsaber b/bin/lightsaber @@ -1,4 +1,3 @@ -#!/bin/sh # Author: L. S., a long time ago # Thank you to jansen.price@gmail.com for the original idea. diff --git a/bin/mfilter b/bin/mfilter @@ -1,4 +1,4 @@ -#!/bin/sh +# filter mails using mblaze filter() diff --git a/bin/music-rename b/bin/music-rename @@ -1,4 +1,3 @@ -#!/bin/sh # extract bandcamp downloaded album and reformat titles diff --git a/bin/play b/bin/play @@ -1,4 +1,3 @@ -#!/bin/sh # play all music from directories and files passed as argument with mplayer diff --git a/bin/status b/bin/status @@ -1,4 +1,3 @@ -#!/bin/sh # plain text status line for wherever useful diff --git a/bin/tty-theme b/bin/tty-theme @@ -1,6 +1,6 @@ -#!/bin/sh # set the theme for the tty from a simple file format + # normal bold # 0 8 black # 1 9 red diff --git a/bin/updd b/bin/updd @@ -1,5 +1,4 @@ -#!/bin/sh -# UPDate Date at the end of sime line or add one to it. +# update date at the end of sime line or add one to it. IFS=' ' diff --git a/bin/version b/bin/version @@ -1,4 +1,3 @@ -#!/bin/sh # simple version control system to store data using hashs # dependencies: diff --git a/bin/www b/bin/www @@ -1,4 +1,3 @@ -#!/bin/sh # mostly plain text static website generator