diff --git a/README.md b/README.md index 2efe150..d5060c6 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,34 @@ A collection of useful scripts. ## Scripts info -| Script | Info | -|----------------|--------------------------------------------------------| -| ffconv | Batch convert mkvs to mp4s. | -| ffconv-a | Batch convert from one format to another. | -| gpltopnm | Convert gpl to ppm. | -| makeself | Make self-extractable archives for *nix-likes. | -| matrix-decrypt | Decrypt matrix attachments that are encrypted. | -| matrix-upload | Upload attachment to matrix homeserver. | -| mkv-cat | Convert multiple videos into one. | -| nds-banner | Create NDS banner.bin files. | -| nlzss | Compress/decompress Nintendo's different LZSS formats. | -| nlzss-c | Compress Nintendo's different LZSS formats. | -| pa-rescan | Rescan audio devices (pulseaudio). | -| pip-upgrade | Upgrade all pip packages. | -| repack | Completely repack an NDS rom with `ndstool`. | -| scanif | Scan several documents one-by-one with SANE/CUPS. | -| ugrade | Upgrade packages for every package manager. | -| unpack | Completely unpack an NDS rom with `ndstool`. | -| yt-dl | youtube-dl "magic" download. | -| yt-mpeg | Turn wav/cover image into a video optimised for yt. | +| Script | Info | +|----------------|-----------------------------------------------------------------------| +| db | Quickly cd into specific directories using short aliases. | +| ffconv | Batch convert mkvs to mp4s. | +| ffconv-a | Batch convert from one format to another. | +| ffconv-ar | Batch convert from one format to another without preserving metadata. | +| gpltopnm | Convert gpl to ppm. | +| makeself | Make self-extractable archives for *nix-likes. | +| matrix-decrypt | Decrypt matrix attachments that are encrypted. | +| matrix-upload | Upload attachment to matrix homeserver. | +| mkv-cat | Convert multiple videos into one. | +| nds-banner | Create NDS banner.bin files. | +| nlzss | Compress/decompress Nintendo's different LZSS formats. | +| nlzss-c | Compress Nintendo's different LZSS formats. | +| pa-rescan | Rescan audio devices (pulseaudio). | +| pip-upgrade | Upgrade all pip packages. | +| repack | Completely repack an NDS rom with `ndstool`. | +| scanif | Scan several documents one-by-one with SANE/CUPS. | +| ugrade | Upgrade packages for every package manager. | +| unpack | Completely unpack an NDS rom with `ndstool`. | +| yt-dl | youtube-dl "magic" download. | +| yt-mpeg | Turn wav/cover image into a video optimised for yt. | + +### db +"./cfg/db" contains the directories in your database. This is the file you edit, and it follows a simple syntax. +```sh + /path/to/dir +``` +The alias name needs to be one argument...otherwise the script can't parse it. + +After editing the db file, you will run "./bin/db" -- which parses the data and outputs a file to "./dat/db-c" containing your aliases in shell form. Add `source /path/to/Scripts/dat/db-c` to your shell config. After that, just remember to source your shell config and everything should work. diff --git a/bin/db b/bin/db new file mode 100755 index 0000000..c178b82 --- /dev/null +++ b/bin/db @@ -0,0 +1 @@ +awk '{print "alias "$1"=\"cd "$2"\""}' ~/Scripts/cfg/db | sort -u > ~/Scripts/dat/db-c diff --git a/bin/ffconv-a b/bin/ffconv-a index d972764..4e8bd15 100755 --- a/bin/ffconv-a +++ b/bin/ffconv-a @@ -6,7 +6,7 @@ read toext for i in *.$ext; do name=`echo "$i" | grep -E '(.+?)(\.[^.]*$|$)'` echo "$name" - ffmpeg -i "$i" "${name}.$toext" + ffmpeg -i "$i" "${name}.$toext" -movflags use_metadata_tags done while true; do read -p "Delete original files? " yn diff --git a/bin/ffconv-ar b/bin/ffconv-ar new file mode 100755 index 0000000..d972764 --- /dev/null +++ b/bin/ffconv-ar @@ -0,0 +1,18 @@ +#!/bin/dash +echo Convert from... +read ext +echo Convert to... +read toext +for i in *.$ext; +do name=`echo "$i" | grep -E '(.+?)(\.[^.]*$|$)'` + echo "$name" + ffmpeg -i "$i" "${name}.$toext" +done +while true; do + read -p "Delete original files? " yn + case $yn in + [Yy]* ) rm *.$ext; exit;; + [Nn]* ) exit;; + * ) printf "Please answer yes or no. ";; + esac +done diff --git a/bin/repack b/bin/repack index 13e9676..3be0e5f 100755 --- a/bin/repack +++ b/bin/repack @@ -1,4 +1,4 @@ #!/bin/dash echo ROM? read rom -ndstool -c $rom -9 arm9.bin -9i arm9i.bin -7 arm7.bin -7i arm7i.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin +ndstool -c $rom -9 arm9.bin -9i arm9i.bin -7 arm7.bin -7i arm7i.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin -o banner.bmp diff --git a/bin/unpack b/bin/unpack index 8136596..8417445 100755 --- a/bin/unpack +++ b/bin/unpack @@ -1,4 +1,4 @@ #!/bin/dash echo ROM? read rom -ndstool -x $rom -9 arm9.bin -9i arm9i.bin -7 arm7.bin -7i arm7i.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin +ndstool -x $rom -9 arm9.bin -9i arm9i.bin -7 arm7.bin -7i arm7i.bin -y9 y9.bin -y7 y7.bin -d data -y overlay -t banner.bin -h header.bin -o banner.bmp diff --git a/cfg/db b/cfg/db new file mode 100644 index 0000000..e26b74a --- /dev/null +++ b/cfg/db @@ -0,0 +1,5 @@ +a ~/Asiakirjat +p ~/Projektit +t ~/Testi +v ~/vimwiki +vd ~/vimwiki/diary diff --git a/dat/db-c b/dat/db-c new file mode 100644 index 0000000..e7cb15c --- /dev/null +++ b/dat/db-c @@ -0,0 +1,5 @@ +alias a="cd ~/Asiakirjat" +alias p="cd ~/Projektit" +alias t="cd ~/Testi" +alias v="cd ~/vimwiki" +alias vd="cd ~/vimwiki/diary"