dot

packages and services management
Log | Files | Refs | README

commit 642173bded3f96732f71c3395350b2a74e2afb4c
parent bf0ce1c08d870857abf5752ddb0f0c94841172d1
Author: josuah <mail@josuah.net>
Date:   Wed, 16 Nov 2016 21:32:17 -0500

Updated piano and adagio

Diffstat:
Mbin/adagio | 37+++++++++++++++++++++----------------
Mbin/piano | 20+++++++-------------
Mbin/version | 61+++++++++++++++++++++++++++++++++++++------------------------
Mshell/.profile | 27++++++++++++++++++++++-----
4 files changed, 87 insertions(+), 58 deletions(-)

diff --git a/bin/adagio b/bin/adagio @@ -1,15 +1,13 @@ -#!/bin/sh # | * # ,--. .--| ,--. ,--, , ,--. # ,--| | | ,--| | | | | | -# `--` `--` `--` `--| ' `--' 2016-10-07 -#----------------`--'----------------------------------------------------------- +# `--` `--` `--` `--| ' `--' 2016-11-16 +#--------------- `--' ---------------------------------------------------------- # Albinoni, Adagio fog G minor adapted to 'beep' -# -# -# Works better with busybox's beep -#===[ NOTES FREQUENCIES ]======================================================= + +# NOTES FREQUENCIES +#------------------------------------------------------------------------------- C0=16 Cd0=17 Db0=17 D0=18 Dd0=19 Eb0=19 E0=21 F0=22 Fd0=23 Gb0=23 G0=25 Gd0=26 Ab0=26 A0=28 Ad0=29 Bb0=29 B0=31 @@ -30,7 +28,9 @@ Gb7=2960 G7=3136 Gd7=3322 Ab7=3322 A7=3520 Ad7=3729 Bb7=3729 B7=3951 C8=4186 Cd8=4435 Db8=4435 D8=4699 Dd8=4978 Eb8=4978 E8=5274 F8=5588 Fd8=5920 Gb8=5920 G8=6272 Gd8=6645 Ab8=6645 A8=7040 Ad8=7459 Bb8=7459 B8=7902 -#===[ MUSIC SCORE ]============================================================= + +# MUSIC SCORE +#------------------------------------------------------------------------------- # with $n the note from above, and $d the duration in millisecond. # Use '1' for silent note. @@ -228,12 +228,17 @@ n="$n $G4 $Ad4 $D5 $G5 $Ad5 $G5 $D5 $Ad4 $D5 $G5 $Ad5 $G5 $Ad5 $D6 $G6 " d="$d 8 7 6 5 4 4 4 4 5 6 7 7 8 10 24 " # -#===[ PLAYING LOOP ]============================================================ -printf '%s' "$d" | sed -re 's/^ *//' -e 's/ *$//' -e 's/ +/\n/g' | -for note in $n -do - read duration - printf '%s %s\n' "$note" "$((duration * tempo))" - beep -f $note -l $(($duration * $tempo)) -done +main() +{ + printf '%s' "$d" | sed -re 's/^ *//' -e 's/ *$//' -e 's/ +/\n/g' | + for note in $n + do + read duration + printf '%s %s\n' "$note" "$((duration * tempo))" + busybox beep -f $note -l $(($duration * $tempo)) + done +} + + +main diff --git a/bin/piano b/bin/piano @@ -4,14 +4,11 @@ # | | ,--| | | | | # ' ' `--` ' ' `--' 2016-10-08 #------------------------------------------------------------------------------- -# Console beep piano! +# Console "beep" piano BEGIN { -# KEYBOARD LAYOUT -#------------------------------------------------------------------------------- - -# QWERTY + # qwerty # ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______ # |Esc |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |Del | # |____|____|____|____|____|____|____|____|____|____|____|____|____|______| @@ -31,7 +28,7 @@ BEGIN { QWERTY = "ZSXDCVGBHNJM<L>:/" "Q@W#ER%T^Y&UI(O)P{+}"; # With shift qwerty = qwerty QWERTY; -# DVORAK + # dvorak # ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______ # |Esc |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10 |F11 |F12 |Del | # |____|____|____|____|____|____|____|____|____|____|____|____|____|______| @@ -53,8 +50,7 @@ BEGIN { layout = dvorak; -# NOTES FREQUENCIES -#------------------------------------------------------------------------------- + # notes frequencies C0 = 16 " "; Cd0 = 17 " "; D0 = 18 " "; Dd0 = 19 " "; E0 = 21 " "; F0 = 22 " "; Fd0 = 23 " "; G0 = 25 " "; @@ -84,8 +80,7 @@ BEGIN { E8 = 5274 " "; F8 = 5588 " "; Fd8 = 5920 " "; G8 = 6272 " "; Gd8 = 6645 " "; A8 = 7040 " "; Ad8 = 7459 " "; B8 = 7902 " "; -# NOTES SELECTION -#------------------------------------------------------------------------------- + # notes selection print "\ _________________________________________________________________________\n\ @@ -116,8 +111,7 @@ BEGIN { ROW1 = row1; ROW2 = C4 Cd4 D4 Dd4 E4 F4 Fd4 G4 Gd4 A4 Ad4 B4 C5 Cd5 D5 Dd5 E5 F5 Fd5 G5; -# ALGORYTHM -#------------------------------------------------------------------------------- + # algorythm split(row1 row2 ROW1 ROW2, frequencies, " "); @@ -133,7 +127,7 @@ BEGIN { } else if (key == " ") { duration = duration * 2; } else if (note = frequencies[index(layout, key)]) { - system("beep -l " duration * 50 " -f " note); + system("beep -l " duration * 70 " -f " note " &"); duration = 1; } } diff --git a/bin/version b/bin/version @@ -104,6 +104,29 @@ init() # +# Get the list of revision that ocuured since one particular revision. +# +history() +{ + local tree="$1" md5sum="$2" + + local revisions="$(ls "$tree/$DIR")" + + # sort revisions by date + printf %s "$revisions" | sort -r | while IFS='-' read -r y m d H M S md5 + do + [ "$md5sum" = "$md5" ] && return 0 + + # rebuild the name + printf '%s-' "y" "$m" "$d" "$H" "$M" "$S" "$md5" + printf '%s\n' "$md5" + done | tac + + die 'revision not found' +} + + +# # Compare current and foreign trees, pull the changes to both, trying to # merge correctly the difference. # @@ -115,38 +138,28 @@ merge() local revision1="$(find "$tree1/$DIR" | tail -n 1)" local revision2="$(find "$tree2/$DIR" | tail -n 1)" -# local revisions="$(ls "$tree1/$DIR"; ls "$tree2/$DIR")" - # all the differences between trees at latest version { sed 's/^/1 /' "$revision1" sed 's/^/2 /' "$revision2" } | sort -k 2 | uniq -w 2 -u | while read -r revision hash path do - grep #TODO remove the - done + # with the file from one tree, get the other tree + case "$revision" in + 1 ) local revision="$revision2" tree="$tree2" ;; + 2 ) local revision="$revision1" tree="$tree1" ;; + esac + # for this entry, look for any similar version in the other tree + origin="$( + cd "$tree/$DIR" + grep -r "$hash $path" + )" -# # sort revisions by date -# printf %s "$revisions" | sort -r | while IFS='-' read -r y m d H M S md5 -# do -# md5sums="$(printf '%s\n%s' "$md5" "$md5sums")" -# -# # rebuild the name -# printf '%s-' "y" "$m" "$d" "$H" "$M" "$S" "$md5" -# printf '%s\n' "$md5" -# done | tac - -# # line number of the revision that matches -# local number="$( -# printf '%s\n' "$revisions" | -# grep -n -x -F "$common" | # find common revisions -# tail -n 1 | # only keep the latest -# cut -d ':' -f 1 # extract line number -# )" -# -# # get different revisions since the latest common one -# printf '%s\n' "$revisions" | sed -n /$(($number + 1))'/,$ p' + # for this common origin, look at what happen since then + + # first, get every commit since then + done } diff --git a/shell/.profile b/shell/.profile @@ -5,11 +5,14 @@ #------------------------------------------------------------------------------- # Shell configuration for any shell (dash, zsh, mksh, bash, busybox's ash...) + # Prevents to be run twice [ "$PROFILE" ] && return 0 || PROFILE=1 + . "$HOME/Config/shell/environment" + export EMAIL="mail@josuah.net" export MAIL="$HOME/Mail/INBOX" @@ -54,6 +57,7 @@ alias d='find . -type d ! -path "*/.git/*" | sed "s/^\\.\\///" | iomenu' alias c='cd "$(d)"' alias g='grep --color=always' alias cl='clear; printf "\n\n"' +alias bh='busybox --help' alias myip='curl icanhazip.com' alias lines='find . -name "*.[ch]" | xargs wc -l' @@ -72,11 +76,14 @@ color() } +# +# Build most projects without installing them. +# buildit() { [ -f './autogen.sh' ] && ./autogen.sh - [ -f './configure' ] && ./configure --prefix="$PREFIX" - make && make clean PREFIX=$PREFIX install clean + [ -f './configure' ] && ./configure + make } @@ -125,24 +132,28 @@ sanitize() # split_at() { - find . | while read -r f + ls | while read -r f do mkdir -p "${f%%$1*}" mv "$f" "${f%%$1*}/${f#*$1}" done } + # # Remove prefix from all files in current directory up to "$1" separator # remove_prefix() { - find . | while read -r f + ls | while read -r f do mv "$f" "${f#*$1}" done } +# +# Sudo, sudo, sudo, sudo, sudo, screen brightness, sudo, sudo... +# light() { printf '%s\n' "$1" | sudo tee "$( @@ -150,13 +161,18 @@ light() )" } + +# +# Why sudo to mount a pendrive! +# mnt() { sudo mount -o uid=$USER -o rw "${1-/dev/sdb1}" "${2-/mnt}" } + # -# Works only in tty and with sudo, sadly. +# Works only in TTY and with sudo, unfortunately. # rotate() { @@ -202,4 +218,5 @@ main() printf '\n\n' } + main