From 725513b9a591b4ca10582597b40c8fad458e648c Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 10:59:51 +0100 Subject: [PATCH 1/6] Bump version. --- 010_saltstack.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -" From 1280c27fcea58fbd8f219f83b0ca52f05a273bf1 Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 11:00:43 +0100 Subject: [PATCH 2/6] Add link to info in comments. --- 010_zram.sh | 1 + 1 file changed, 1 insertion(+) 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 From 244ccef368ec7fe224f49e3759e4e1fbbbc01e40 Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 11:07:00 +0100 Subject: [PATCH 3/6] Add function/alias to allow uploading files to http://transfer.sh from the commandline. --- 020_fish.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) 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" From 5d0f729cbc01311fd1f6d9fc71b1511083cdb5c6 Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 11:07:24 +0100 Subject: [PATCH 4/6] Add function/alias to allow uploading files to http://transfer.sh from the commandline. --- 020_zsh.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/020_zsh.sh b/020_zsh.sh index 96f4f54..592c2e8 100644 --- a/020_zsh.sh +++ b/020_zsh.sh @@ -263,5 +263,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 "See ~/$APPLICATION.log for all transfers." + + # cleanup + rm -f $tmpfile +} +EOF + + chown -R root.root /usr/local/share/zsh/site-functions chmod -R 755 /usr/local/share/zsh/site-functions From 91f5c412d9174f49f4084927ac38374ed095158e Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 11:08:36 +0100 Subject: [PATCH 5/6] Add waterfox to the alternatives list. --- 020_waterfox.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/020_waterfox.sh b/020_waterfox.sh index e82e85c..eaa2794 100644 --- a/020_waterfox.sh +++ b/020_waterfox.sh @@ -14,6 +14,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 From d56a1fad21e52f68e9aa0d647c25d8f5bc649e27 Mon Sep 17 00:00:00 2001 From: Cyteen May Date: Sun, 17 Jun 2018 11:38:11 +0100 Subject: [PATCH 6/6] Add carriage returns for log output formating. --- 020_zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/020_zsh.sh b/020_zsh.sh index 592c2e8..8976491 100644 --- a/020_zsh.sh +++ b/020_zsh.sh @@ -325,7 +325,7 @@ transfer() { RIGHTNOW="$(date)" EXPIRES="$(date -d "+14 days")" echo -e "$(cat "$tmpfile") - uploaded $RIGHTNOW - expires $EXPIRES\n" >> ~/$APPLICATION.log - echo "See ~/$APPLICATION.log for all transfers." + echo "\n\nSee ~/$APPLICATION.log for all transfers.\n" # cleanup rm -f $tmpfile