dot

packages and services management
Log | Files | Refs | README

commit 08374c5397dc178e4439577c9c06fc51b488f69a
parent bfa1b18e6762c632486654533aee7c996f7f48e8
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 28 Feb 2018 00:01:44 +0100

added sqlite and mujs

Diffstat:
M.ssh/config | 3+--
Mbin/mv-flac | 10+++++-----
Mbin/mv-sane | 3++-
Mbin/pack | 8+-------
Mbin/qemu | 15+++++++++------
Mbin/xdg-open | 2+-
Apack/mujs/build | 12++++++++++++
Apack/mujs/tar | 1+
Apack/sqlite/tar | 1+
Ashell/bin/phaste | 42++++++++++++++++++++++++++++++++++++++++++
10 files changed, 75 insertions(+), 22 deletions(-)

diff --git a/.ssh/config b/.ssh/config @@ -1,4 +1,5 @@ AddKeysToAgent yes +IdentityFile /mnt/key/josuah.key host git.nixers.net IdentityFile /mnt/key/git.nixers.net.key @@ -11,5 +12,3 @@ host github.com host git.epitech.eu IdentityFile /mnt/key/epitech.eu.key - -IdentityFile /mnt/key/josuah.key diff --git a/bin/mv-flac b/bin/mv-flac @@ -22,7 +22,7 @@ s() { # Grab the number 'n' out of a "n/m" format n() { - sed 's/\/.*//' + sed -r 's/^[^0-9]*0*([0-9]+).*/\1/' } case "$1" in @@ -30,9 +30,9 @@ case "$1" in ar="$(metaflac --show-tag=ARTIST "$1" | v | s)" da="$(metaflac --show-tag=DATE "$1" | y)" al="$(metaflac --show-tag=ALBUM "$1" | v | s)" - dn="$(metaflac --show-tag=DISCNUMBER "$1" | v | n | s)" - dt="$(metaflac --show-tag=DISCTOTAL "$1" | v | s)" - tn="$(metaflac --show-tag=TRACKNUMBER "$1" | v | n | s)" + dt="$(metaflac --show-tag=DISCTOTAL "$1" | v | n)" + dn="$(metaflac --show-tag=DISCNUMBER "$1" | v | n)" + tn="$(metaflac --show-tag=TRACKNUMBER "$1" | v | n)" ti="$(metaflac --show-tag=TITLE "$1" | v | s)" ;; esac @@ -40,4 +40,4 @@ esac [ "$dn" = "$dt" ] && dn="" || dn="$dn-" mkdir -p "$ar/$da-$al" -ln "$1" "$ar/$da-$al/$dn$(printf %02d "${tn:-0}")-$ti.flac" +ln "$1" "$ar/$da-$al/$dn$(printf %02d "$tn")-$ti.flac" diff --git a/bin/mv-sane b/bin/mv-sane @@ -5,7 +5,8 @@ find . -mindepth 1 | while IFS='' read -r path do new="$(dirname "$path")/$(basename "$path" | - tr -s '\t #&;*?<>|"()[]{}\\_=+'\' - | sed 's/^-//; s/-$//')" + tr -s '\t #&;*?<>|"()[]{}\\_=+'\' - | + sed -r 's/^([0-9]+)\.*/\1/; s/^-//; s/-$//')" [ "$path" = "$new" ] || mv "$path" "$new" done diff --git a/bin/pack b/bin/pack @@ -38,13 +38,7 @@ case "$1" in cd "$SRC" mkdir -p "$OPT" - - [ ! -f "$PKG/build" ] || exec "$PKG/build" - [ ! -f "$PKG/config.mk" ] || cp "$PKG/config.mk" "$SRC" - [ ! -f "$PKG/config.h" ] || cp "$PKG/config.h" "$SRC" - [ ! -f "$SRC/configure" ] || "$SRC/configure" --prefix="$OPT" - make - make PREFIX="$OPT" install + exec "$PKG/build" ;; (add) [ -d "$OPT" ] || "$0" build "$2" || rm -r "$OPT" diff --git a/bin/qemu b/bin/qemu @@ -1,6 +1,6 @@ -#!/bin/sh -e +#!/bin/sh -ex -mkdir -p "$HOME/log/qemu" "$HOME/var/qemu" "$HOME/lib/qemu" +mkdir -p "$HOME/var/log/qemu" "$HOME/var/qemu" "$HOME/lib/qemu" case "$1" in (new) @@ -16,20 +16,23 @@ case "$1" in beg="10000" end="10100" - port="$(netstat -natl | awk -v b="$beg" -v e="$end" \ - '$6 == "LISTEN" && sub(".*[.:]", "", $4) && b <= $4 + 0 && $4 + 0 <= e { + port="$(netstat -natl | awk -v b="$beg" -v e="$end" ' + $6 == "LISTEN" && + sub(".*[.:]", "", $4) && + b <= $4 + 0 && + $4 + 0 <= e + { print($4); }' | sort -ru | sed q)" port="${port:+$(($port + 1))}" port="${port:-$beg}" exec nohup qemu-system-x86_64 \ - -m 500M \ -device "e1000,netdev=net0" \ -netdev "user,id=net0,hostfwd=tcp::$port-:22" \ -display "none" \ "$HOME/var/qemu/$2" \ - 1>> "$HOME/log/qemu/$2" & + 1>> "$HOME/var/log/qemu/$2" & ;; (list) (pgrep -lf qemu-system- || pgrep -la qemu-system-) 2> /dev/null | diff --git a/bin/xdg-open b/bin/xdg-open @@ -215,7 +215,7 @@ esac find "$1" -type f | sort | while IFS='' read -r song do printf '%s\n' "$song" - o "$song" + avplay "$song" done exit ;; diff --git a/pack/mujs/build b/pack/mujs/build @@ -0,0 +1,12 @@ +#!/bin/sh -e + +case "$(uname)" in +(Linux) + make="make" + ;; +(*BSD) + make="gmake" + ;; +esac + +$make prefix="$OPT" install diff --git a/pack/mujs/tar b/pack/mujs/tar @@ -0,0 +1 @@ +http://dev.mujs.com/downloads/mujs-1.0.0.tar.xz diff --git a/pack/sqlite/tar b/pack/sqlite/tar @@ -0,0 +1 @@ +https://www.sqlite.org/2018/sqlite-autoconf-3220000.tar.gz diff --git a/shell/bin/phaste b/shell/bin/phaste @@ -0,0 +1,41 @@ +#!/bin/sh + +# generate an upload url for pastebin.corp.gandi.net from standard input + + +PHABRICATOR='https://phabricator.corp.gandi.net/paste/edit/form/default' + + +#1 text string to encode + +encode() +{ + text= + + while [ "$1" ] + do + case "$1" in + [A-Za-z0-9_.~-]* ) + text=$text$( + printf %s "$1" | + dd bs=1 count=1 2> /dev/null + ) + ;; + * ) + text=$text%$( + printf %s "$1" | + dd bs=1 count=1 2> /dev/null | + od -A n -t x1 | + tr -d ' ' + ) + ;; + esac + + set -- "${1#?}" + done + + printf %s "$text" +} + + +printf "$PHABRICATOR?text=%s\n" "$(encode "$(tee)")"+ \ No newline at end of file