all repos — dotfiles @ 28c5e0e91a423074343ec55c590c362fd7db9478

my *nix dotfiles

refactor: clean up bin/
Anirudh icyph0x@protonmail.com
Tue, 03 Apr 2018 00:57:51 +0530
commit

28c5e0e91a423074343ec55c590c362fd7db9478

parent

923b44308f866e1302672db2a9f63debfc11920a

5 files changed, 0 insertions(+), 236 deletions(-)

jump to
D bin/colors2.sh

@@ -1,79 +0,0 @@

-#!/bin/bash - -useage() { - printf "\n\e[1;4mAscii Escape Code Helper Utility\e[m\n\n" - printf " \e[1mUseage:\e[m colors.sh [-|-b|-f|-bq|-fq|-?|?] [start] [end] [step]\n\n" - printf "The values for the first parameter may be one of the following:\n\n" - printf " \e[1m-\e[m Will result in the default output.\n" - printf " \e[1m-b\e[m This will display the 8 color version of this chart.\n" - printf " \e[1m-f\e[m This will display the 256 color version of this chart using foreground colors.\n" - printf " \e[1m-q\e[m This will display the 256 color version of this chart without the extra text.\n" - printf " \e[1m-bq\e[m This will display the 8 color version of this chart without the extra text.\n" - printf " \e[1m-fq\e[m This will display the 256 color version of this chart using foreground colors without the extra text.\n" - printf " \e[1m-?|?\e[m Displays this help screen.\n" - printf "\nThe remaining parameters are only used if the first parameter is one of: \e[1m-,-f,q,fq\e[m\n\n" - printf " \e[1mstart\e[m The color index to begin display at.\n" - printf " \e[1mend\e[m The color index to stop display at.\n" - printf " \e[1mstart\e[m The number of indexes to increment color by each iteration.\n\n\n" - -} -verbose() { - if [[ "$1" != "-q" && "$1" != "-fq" && "$1" != "-bq" ]]; then - printf "\nTo control the display style use \e[1m%s\e[m where \e[1m%s\e[m is:\n" '\e[{$value}[:{$value}]m' '{$value}' - printf "\n 0 Normal \e[1m1 Bold\e[m \e[2m2 Dim\e[m \e[3m3 ???\e[m \e[4m4 Underlined\e[m \e[5m5 Blink\e[m \e[6m6 ???\e[m \e[7m7 Inverted\e[m \e[8m8 Hidden\e[m\n\n" - printf "If \e[1m%s\e[m is not provided it will reset the display.\n\n" '{$value}' - fi -} -eight_color() { - local fgc bgc vals seq0 - if [ "$1" != "-bq" ]; then - printf "\n\e[1;4m8 Color Escape Value Pallette\e[m\n\n" - printf "Color escapes are \e[1m%s\e[m\n" '\e[${value};...;${value}m' - printf " Values \e[1m30..37\e[m are \e[1mforeground\e[m colors\n" - printf " Values \e[1m40..47\e[m are \e[1mbackground\e[m colors\n\n" - fi - for fgc in {30..37}; do - for bgc in {40..47}; do - fgc=${fgc#37} - bgc=${bgc#40} - vals="${fgc:+$fgc;}${bgc}" - vals=${vals%%;} - seq0="${vals:+\e[${vals}m}" - printf " %-9s" "${seq0:-(default)}" - printf " ${seq0}TEXT\e[m" - printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" - done - printf "\e[0m\n" - done -} - - -if [[ "$1" == "-b" || "$1" == "-bq" ]]; then - eight_color "$1" - verbose "$1" -elif [[ "$1" == "" || "$1" == "-" || "$1" == "-f" || "$1" == "-q" || "$1" == "-fq" ]]; then - start=${2:-0} - end=${3:-255} - step=${4:-1} - color=$start - style="48;5;" - if [[ "$1" == "-f" || "$1" == "-fq" ]]; then - style="38;5;" - fi - perLine=$(( ( $(tput cols) - 2 ) / 9 )); - if [[ "$1" != "-q" && "$1" != "-fq" ]]; then - printf "\n\e[1;4m256 Color Escape Value Pallette\e[0m\n\n" - printf " \e[1m%s\e[m for \e[1mbackground\e[m colors\n \e[1m%s\e[m for \e[1mforeground\e[m colors\n\n" '\e[48;5;${value}m' '\e[38;5;${value}m' - fi - while [ $color -le $end ]; do - printf "\e[m \e[${style}${color}m %3d \e[m " $color - ((color+=step)) - if [ $(( ( ( $color - $start ) / $step ) % $perLine )) -eq 0 ]; then - printf "\n" - fi - done - printf "\e[m\n" - verbose "$1" -else - useage -fi
D bin/oxo.sh

@@ -1,92 +0,0 @@

-#!/bin/bash -# 0x0 - client for 0x0.st - -me=${0##*/} -host=https://0x0.st - -if [[ ! -t 1 ]];then - quiet=true -fi - -help() { - cat >&2 <<EOF -Usage: ${me} [-f <file>] [-s <url>] [-u <url>] [file] -Client for interacting with 0x0.st. -If no file is given, upload stdin. - -f <file> - upload <file> - -s <url> - shorten <url> - -u <url> - upload content of <url> -EOF -} - -clip() { - if command -v xsel >/dev/null 2>&1;then - printf '%s' "$@" | xsel -b - fi -} - -file_upload() { - local curl_opts="-s" file="$1" type - [[ "${quiet}" ]] || curl_opts="-#" - [[ "${quiet}" ]] || echo "uploading \"${file}\"..." >&2 - [[ "$#" -gt 1 ]] && echo -n "${file} ... " - url=$(curl ${curl_opts} -F "file=@${file}" "${host}") - echo "${url}" - clip "${url}" -} - -shorten_url() { - local curl_opts="-s" url="$1" shortened - [[ "${quiet}" ]] || curl_opts="-#" - [[ "${quiet}" ]] || echo "shortening \"${url}\"..." >&2 - [[ "$#" -gt 1 ]] && echo -n "${url} ... " - shortened=$(curl ${curl_opts} -F "shorten=${url}" "${host}") - echo "${shortened}" - clip "${shortened}" -} - -upload_url() { - local curl_opts="-s" url="$1" uploaded - [[ "${quiet}" ]] || curl_opts="-#" - [[ "${quiet}" ]] || echo "uploading \"${url}\"..." >&2 - [[ "$#" -gt 1 ]] && echo -n "${url} ... " - uploaded=$(curl ${curl_opts} -F "url=${url}" "${host}") - echo "${uploaded}" - clip "${uploaded}" -} - -# 1KiB = 1024 bytes -# 1MiB = 1024 KiB -# max size - 256MiB - -max_size=$(( (1024*1024) * 256 )) - -if [[ -f "$1" || "$#" -lt 1 ]];then - mode="default" -else - mode="$1" - shift -fi - -case "$mode" in - default) - if [[ "$#" -gt 0 ]];then - file_upload "${@}" - else - quiet=true file_upload "-" - fi - ;; - -f) - file_upload "${@}" - ;; - -u) - upload_url "${@}" - ;; - -s) - shorten_url "${@}" - ;; - -h|--help) - help - ;; -esac -
D bin/postgame.sh

@@ -1,12 +0,0 @@

-#!/bin/bash - -# remove write-lock -chattr -i /etc/resolv.conf - -# start dhcpcd -systemctl start dhcpcd - -# restart NetworkManager for re-resolving IP -systemctl restart NetworkManager - -
D bin/pregame.sh

@@ -1,12 +0,0 @@

-#!/bin/bash -# change nameservers - echo nameserver 8.8.8.8 > /etc/resolv.conf - -# write-lock the file (even root can't edit it) - chattr +i /etc/resolv.conf - -# kill dhcpcd (messes with IP) - systemctl stop dhcpcd - -# start VPN - openvpn --config /home/icyphox/icy.ovpn
D bin/spaceinvaders.sh

@@ -1,41 +0,0 @@

-#!/bin/bash -# -# This file echoes a bunch of color codes to the -# terminal to demonstrate what's available. Each -# line is the color code of one foreground color, -# out of 17 (default + 16 escapes), followed by a -# test use of that color on all nine background -# colors (default + 8 escapes). -# - - -f=3 b=4 -for j in f b; do - for i in {0..7}; do - printf -v $j$i %b "\e[${!j}${i}m" - done -done -bld=$'\e[1m' -rst=$'\e[0m' - -cat << EOF - - $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst - $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst - $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst - $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst - - $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst - $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst - $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst - $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst - - - $f7▌$rst - - $f7▌$rst - - $f7 ▄█▄ $rst - $f7▄█████████▄$rst - $f7▀▀▀▀▀▀▀▀▀▀▀$rst -EOF