diff --git a/010_saltstack.sh b/010_saltstack.sh index 2b81de2..25ca3ec 100644 --- a/010_saltstack.sh +++ b/010_saltstack.sh @@ -39,9 +39,10 @@ SALT_VERSION=2016.3 SALT_VERSION=2016.11 SALT_VERSION=2017.7 SALT_VERSION=archive/2017.7.3 +SALT_VERSION=2018.3.0 SALT_VERSION=latest -REFRESHED_AT=2018-02-20 +REFRESHED_AT=2018-06-10 mkdir -p /etc/apt/sources.list-available #bash -c "wget -q -O- "http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key" | apt-key add -" diff --git a/010_zram.sh b/010_zram.sh index ffe8bcb..5072bab 100644 --- a/010_zram.sh +++ b/010_zram.sh @@ -1,4 +1,5 @@ #!/bin/sh +# https://www.kernel.org/doc/Documentation/blockdev/zram.txt cat > /etc/init.d/zram <<'EOF' #!/bin/sh ### BEGIN INIT INFO diff --git a/020_fish.sh b/020_fish.sh index 425bef5..e8b19d4 100644 --- a/020_fish.sh +++ b/020_fish.sh @@ -63,6 +63,52 @@ function sr eval $argv > /dev/null 2>&1 & end +function transfer + if test (count $argv) -eq 0 + echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + end + + ## get temporarily filename, output is written to this file show progress can be showed + set tmpfile ( mktemp -t transferXXX ) + + ## upload stdin or file + set file $argv[1] + + #if tty -s; + #then + set basefile (basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + + # if [ ! -e $file ]; + # then + # echo "File $file doesn't exists." + # return 1 + # fi + + if test -d $file + # zip directory and transfer + set zipfile ( mktemp -t transferXXX.zip ) + # echo (dirname $file) + #cd (dirname $file) and echo (pwd) + zip -r -q - $file >> $zipfile + curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile + rm -f $zipfile + else + # transfer file + curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile + end + #else + # # transfer pipe + # curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile + #fi + + ## cat output link + cat $tmpfile + + ## cleanup + rm -f $tmpfile +end + alias subl "subl3" alias vim "nvim" diff --git a/020_waterfox.sh b/020_waterfox.sh index a48183a..22e05c2 100644 --- a/020_waterfox.sh +++ b/020_waterfox.sh @@ -17,6 +17,8 @@ apt-get update apt-get install -y waterfox +update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/waterfox 201 + # Themes ## Australis Dark - enabled in Firefox 53 ## Has rounded corners on active tab and grey surround diff --git a/020_zsh.sh b/020_zsh.sh index a77f474..3adbcc5 100644 --- a/020_zsh.sh +++ b/020_zsh.sh @@ -274,5 +274,75 @@ alias ipython="_py_version" alias jupyter="_py_version" EOF +cat > .zsh_aliases.d/003-transfer.zsh <<'EOF' +# +# Defines transfer alias and provides easy command line file and folder sharing. +# +# Authors: +# Remco Verhoef +# + +curl --version 2>&1 > /dev/null +if [ $? -ne 0 ]; then + echo "Could not find curl." + return 1 +fi + +transfer() { + # check arguments + if [ $# -eq 0 ]; + then + echo -e "No arguments specified.\n\nUsage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + fi + + # get temporarily filename, output is written to this file show progress can be showed + tmpfile=$( mktemp -t transferXXX ) + + # upload stdin or file + file=$1 + + if tty -s; + then + basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + + if [ ! -e $file ]; + then + echo "File $file doesn't exists." + return 1 + fi + + if [ -d $file ]; + then + # zip directory and transfer + zipfile=$( mktemp -t transferXXX.zip ) + cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile + curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile + rm -f $zipfile + else + # transfer file + curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile + fi + else + # transfer pipe + curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile + fi + + # cat output link + cat $tmpfile + + # log file link + APPLICATION="${0##*/}" + RIGHTNOW="$(date)" + EXPIRES="$(date -d "+14 days")" + echo -e "$(cat "$tmpfile") - uploaded $RIGHTNOW - expires $EXPIRES\n" >> ~/$APPLICATION.log + echo "\n\nSee ~/$APPLICATION.log for all transfers.\n" + + # cleanup + rm -f $tmpfile +} +EOF + + chown -R root.root /usr/local/share/zsh/site-functions chmod -R 755 /usr/local/share/zsh/site-functions