aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-05 07:48:16 +0200
committerneodarz <neodarz@neodarz.net>2019-09-05 07:48:16 +0200
commit9b19480228d8421c3987a634a602012c953a993e (patch)
tree4bce21766502f3a72bb2002daeea2a406c2a3bda /dotfiles/scripts
parent40dddc15f4a323d3c84c84be7bb2c5ca94d3c07c (diff)
downloaddotfiles_dotdrop-9b19480228d8421c3987a634a602012c953a993e.tar.xz
dotfiles_dotdrop-9b19480228d8421c3987a634a602012c953a993e.zip
Add some scripts
Diffstat (limited to '')
-rwxr-xr-xdotfiles/scripts/2gif.sh109
-rwxr-xr-xdotfiles/scripts/AN2Linux.sh9
-rwxr-xr-xdotfiles/scripts/bin-xfer36
-rwxr-xr-xdotfiles/scripts/cycle-workspace-multiscreen.py74
-rwxr-xr-xdotfiles/scripts/cycle-workspace.py26
-rwxr-xr-xdotfiles/scripts/domainsTest.sh12
-rwxr-xr-xdotfiles/scripts/dropshadow.sh29
-rwxr-xr-xdotfiles/scripts/fingerprint66
-rwxr-xr-xdotfiles/scripts/i3removesupportof.py56
-rwxr-xr-xdotfiles/scripts/internet-from_wifi_to_internet.sh21
-rwxr-xr-xdotfiles/scripts/ip.sh11
-rwxr-xr-xdotfiles/scripts/launch_rofi-pass.sh1
-rwxr-xr-xdotfiles/scripts/lessfilter.sh20
-rwxr-xr-xdotfiles/scripts/linux_system_error_list.py46
-rwxr-xr-xdotfiles/scripts/linux_system_error_list.sh4
-rwxr-xr-xdotfiles/scripts/mpvbg27
-rwxr-xr-xdotfiles/scripts/my-pinentry16
-rwxr-xr-xdotfiles/scripts/notify1
-rwxr-xr-xdotfiles/scripts/nullify2
-rw-r--r--dotfiles/scripts/pyrnotify.py160
-rwxr-xr-xdotfiles/scripts/searx.sh3
-rwxr-xr-xdotfiles/scripts/ssh.sh24
-rwxr-xr-xdotfiles/scripts/switch-workspace.py45
-rwxr-xr-xdotfiles/scripts/switch_audio.sh16
-rwxr-xr-xdotfiles/scripts/task28
-rwxr-xr-xdotfiles/scripts/tdone30
-rwxr-xr-xdotfiles/scripts/tm.sh49
-rwxr-xr-xdotfiles/scripts/watch12
-rwxr-xr-xdotfiles/scripts/weechat_notify.sh12
-rwxr-xr-xdotfiles/scripts/what.sh42
-rwxr-xr-xdotfiles/scripts/what_alias.sh56
-rwxr-xr-xdotfiles/scripts/what_command_help.sh40
-rwxr-xr-xdotfiles/scripts/working.sh3
-rw-r--r--dotfiles/scripts/working_tmux.yaml15
-rw-r--r--dotfiles/scripts/write_on_disk.rb63
-rwxr-xr-xdotfiles/scripts/zsh_aliases_functions.sh6
36 files changed, 1170 insertions, 0 deletions
diff --git a/dotfiles/scripts/2gif.sh b/dotfiles/scripts/2gif.sh
new file mode 100755
index 0000000..ec325dc
--- /dev/null
+++ b/dotfiles/scripts/2gif.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+
+# source: https://github.com/Drakirus/dotfiles/blob/master/bin/2gif
+
+$(ffmpeg --help 2> /dev/null > /dev/null)
+
+if [[ $? -ne 0 ]]; then
+ echo "ffmpeg is required!"
+ exit 1
+fi
+
+# default values
+FPS=12
+
+# read the options
+TEMP=`getopt -o c:r:f:t:s:d:hl:: --long resolution:,fps:,start:,to:,duration:,help,loop:: -n $0 -- "$@"`
+eval set -- "$TEMP"
+
+# extract options and their arguments into variables.
+while true ; do
+ case "$1" in
+ -h|--help)
+ echo -e "Usage: $0 [options] <input video file> <output gif name>\n"
+ echo "Options:"
+ echo " -h, --help Show this help"
+ echo " -r, --resolution Set the pixels wide (preserving the aspect ratio)"
+ echo " -f, --fps Set the gif frame rate"
+ echo " default 12"
+ echo " -s, --start Skip the first x seconds"
+ echo " -t, --to Capture to x seconds"
+ echo " -d, --duration Set the duration"
+ echo " -l, --loop Number of times to loop the output"
+ echo " default: no loop"
+ echo " -l output loop infinitely"
+ echo " -l10 output loop 10 times"
+ echo "Examples:"
+ echo " $0 input.mp4 out.gif"
+ echo " $0 input.mp4 out.gif -s"00:01" -d5 -r450"
+ echo " $0 input.mp4 out.gif -s"20:00" -d5 -l --fps30"
+ exit;;
+ -r|--resolution)
+ case "$2" in
+ "") shift 2 ;;
+ *) RESOLUTION="$2"; shift 2 ;;
+ esac ;;
+ -t|--to)
+ case "$2" in
+ "") shift 2 ;;
+ *) TO="-t $2"; shift 2 ;;
+ esac ;;
+ -l|--loop)
+ case "$2" in
+ "") LOOP="-loop=0" ; shift 2 ;;
+ *) LOOP="-loop=$2" ; shift 2 ;;
+ esac ;;
+ -f|--fps)
+ case "$2" in
+ "") shift 2 ;;
+ *) FPS="$2"; shift 2 ;;
+ esac ;;
+ -s|--start)
+ case "$2" in
+ "") shift 2 ;;
+ *) START="-ss $2"; shift 2 ;;
+ esac ;;
+ -d|--duration)
+ case "$2" in
+ "") shift 2 ;;
+ *) DURATION="-t $2"; shift 2 ;;
+ esac ;;
+ --) shift ; break ;;
+ *) echo "Internal error!" ; exit 1 ;;
+ esac
+done
+
+if [[ "$#" -ne 2 && "$#" -ne 1 ]]; then
+ echo -e "Usage: $0 [options] <input video file> <output gif name>\n"
+ echo -e "Illegal number of parameters or parameters.\nFor more informations:\n $0 --help "
+ exit 1
+fi
+
+OUTPUT="$2"
+
+if [[ "$#" -eq 1 ]]; then
+ filename=$(basename "$1")
+ filename="${filename%.*}.gif"
+ OUTPUT=$filename
+fi
+
+if [[ "$RESOLUTION" -eq "" ]]; then
+ eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=width "$1")
+ RESOLUTION=${streams_stream_0_width}
+fi
+
+palette=$(mktemp /tmp/palette_XXXX.png)
+
+filters="fps=$FPS,scale=$RESOLUTION:-1:flags=lanczos"
+
+# echo $filters
+
+# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html#usage
+
+# create global color palette
+ffmpeg -v warning $START $TO $DURATION -i "$1" -vf "$filters,palettegen" -y "$palette"
+
+# create GIF
+ffmpeg -v warning $START $TO $DURATION -i "$1" -i "$palette" -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$OUTPUT"
+
+rm $palette
diff --git a/dotfiles/scripts/AN2Linux.sh b/dotfiles/scripts/AN2Linux.sh
new file mode 100755
index 0000000..263f932
--- /dev/null
+++ b/dotfiles/scripts/AN2Linux.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [[ $1 && $2 && $3 ]];then
+ ssh-add -l |grep -q `ssh-keygen -lf $1 | awk '{print $2}'` || ssh-add $1
+ ssh root@$2 "/root/AN2Linux.sh start $(\ip addr show $3 | grep "inet " | cut -d'/' -f1 | awk '{print $2}')"; an2linuxserver.py; ssh root@$2 "/root/AN2Linux.sh stop $(\ip addr show $3 | grep "inet " | cut -d'/' -f1 | awk '{print $2}')";
+else
+ echo "Usage:"
+ echo " $0 <ssh_key> <ip_server> <interface>"
+fi
diff --git a/dotfiles/scripts/bin-xfer b/dotfiles/scripts/bin-xfer
new file mode 100755
index 0000000..e2ccce5
--- /dev/null
+++ b/dotfiles/scripts/bin-xfer
@@ -0,0 +1,36 @@
+#!/bin/sh
+INFILE=/dev/null
+OUTFILE=/dev/null
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -i)
+ shift
+ INFILE="$1"
+ ;;
+ -o)
+ shift
+ OUTFILE="$1"
+ ;;
+ -h|--help)
+ echo "$0 -i infile -o outfile"
+ ;;
+ *)
+ INFILE="$1"
+ esac
+ shift
+done
+cat << EOF
+binary-xfer utility for minicom
+Sending file ${INFILE} to ${OUTFILE}
+EOF
+
+/usr/bin/pv --force -i 0.25 -B 128 ${INFILE} 2>&1 > ${OUTFILE}
+# Use the line below if you don't have pv!
+
+# /bin/cat ${INFILE} > ${OUTFILE}
+cat << EOF
+
+File transfer complete
+EOF
+sleep 1
diff --git a/dotfiles/scripts/cycle-workspace-multiscreen.py b/dotfiles/scripts/cycle-workspace-multiscreen.py
new file mode 100755
index 0000000..e5e70ef
--- /dev/null
+++ b/dotfiles/scripts/cycle-workspace-multiscreen.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+# cycle-workspace-multiscreen
+# Moves the currently active workspace to the left/right/top/bottom active
+# display.
+# Depends on i3-py (`pip install i3-py`)
+# Because workspace name are fixed to a display, just rename workspace can
+# change workspace to another display.
+# So for the moment this script is tested and work if workspaces are fixed
+# to a display.
+
+import i3
+import sys
+
+# figure out what is on, and what is currently on your screen.
+workspace_origin = list(filter(lambda s: s['focused'], i3.get_workspaces()))[0]
+outputs = list(filter(lambda s: s['active'], i3.get_outputs()))
+output_origin = ""
+
+for output in outputs:
+ if output['current_workspace'] == workspace_origin['name']:
+ output_origin = output
+
+output_destination = workspace_origin
+
+if sys.argv[1] == "right":
+ output_origin_x = output_origin['rect']['x']
+ output_origin_width = output_origin['rect']['width']
+ next_workspace_start = output_origin_x + output_origin_width
+ for output in outputs:
+ if next_workspace_start == output['rect']['x']:
+ output_destination = output
+
+if sys.argv[1] == "left":
+ output_origin_x = output_origin['rect']['x']
+ output_origin_width = output_origin['rect']['width']
+ next_workspace_start = output_origin_x - output_origin_width
+ for output in outputs:
+ next_workspace_start = output_origin_x - output['rect']['width']
+ if next_workspace_start == output['rect']['x']:
+ output_destination = output
+
+if sys.argv[1] == "bottom":
+ output_origin_y = output_origin['rect']['y']
+ output_origin_height = output_origin['rect']['height']
+ next_workspace_start = output_origin_y + output_origin_height
+ for output in outputs:
+ if next_workspace_start == output['rect']['y']:
+ output_destination = output
+
+if sys.argv[1] == "top":
+ output_origin_y = output_origin['rect']['y']
+ output_origin_height = output_origin['rect']['height']
+ next_workspace_start = output_origin_y - output_origin_height
+ for output in outputs:
+ next_workspace_start=output_origin_y - output['rect']['height']
+ if next_workspace_start == output['rect']['y']:
+ output_destination = output
+
+if (output_destination != workspace_origin):
+ # Move origin workspace to the correct screen
+ i3.command('move', 'workspace to output '+output_destination['name'])
+ # Rename origin workspace to temporary workspace of the screen destination
+ i3.command('rename', 'workspace '+str(workspace_origin['name'])+' to a_fucking_workspace')
+ # Change focus to the workspace destination
+ i3.workspace(output_destination['current_workspace'])
+ # Move destination workspace to the correct screen
+ i3.command('move', 'workspace to output '+workspace_origin['output'])
+ # Rename workspace destination to the origin workspace
+ i3.command('rename', 'workspace '+output_destination['current_workspace']+' to '+str(workspace_origin['name']))
+ # Rename temporary workspace to workspace destination
+ i3.command('rename', 'workspace a_fucking_workspace to '+output_destination['current_workspace'])
+ # Change focus the workspace destination
+ i3.workspace(output_destination['current_workspace'])
diff --git a/dotfiles/scripts/cycle-workspace.py b/dotfiles/scripts/cycle-workspace.py
new file mode 100755
index 0000000..7f176db
--- /dev/null
+++ b/dotfiles/scripts/cycle-workspace.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#https://gist.github.com/97-109-107/b70356670ae8309ffb4f
+
+import i3
+
+outputs = i3.get_outputs()
+workspaces = i3.get_workspaces()
+
+# figure out what is on, and what is currently on your screen.
+workspace = list(filter(lambda s: s['focused']==True, workspaces))
+output = list(filter(lambda s: s['active']==True, outputs))
+
+# figure out the other workspace name
+other_workspace = list(filter(lambda s: s['name']!=workspace[0]['output'], output))
+
+
+
+# send current to the no-active one
+i3.command('move', 'workspace to output '+other_workspace[0]['name'])
+
+
+
+#print(str(list(filter(lambda s: s['active']==True, workspaces))))
+
+i3.command('workspace', other_workspace[0]['current_workspace'])
+i3.command('move', 'workspace to output '+workspace[0]['output'])
diff --git a/dotfiles/scripts/domainsTest.sh b/dotfiles/scripts/domainsTest.sh
new file mode 100755
index 0000000..2b3151a
--- /dev/null
+++ b/dotfiles/scripts/domainsTest.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# Program name: pingall.sh
+date
+cat domains.txt | while read output
+do
+ ping -c 1 "$output" &> /dev/null
+ if [ $? -eq 0 ]; then
+ echo "node $output is up"
+ else
+ echo "node $output is down"
+ fi
+done
diff --git a/dotfiles/scripts/dropshadow.sh b/dotfiles/scripts/dropshadow.sh
new file mode 100755
index 0000000..4e70f82
--- /dev/null
+++ b/dotfiles/scripts/dropshadow.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# NAME: dropshadow.sh
+# VERSION:
+# AUTHOR: (c) 2013 Glutanimate
+# DESCRIPTION: - adds transparent dropshadow to images (e.g. screenshots)
+# - moves them to predefined screenshot folder
+# FEATURES:
+# DEPENDENCIES: imagemagick suite
+#
+# LICENSE: MIT license (http://opensource.org/licenses/MIT)
+#
+# NOTICE: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+# OR OTHER DEALINGS IN THE SOFTWARE.
+#
+#
+# USAGE: dropshadow.sh <image>
+
+SCREENSHOTFOLDER="$HOME/Screenshots"
+
+
+FILE="${1}"
+FILENAME="${FILE##*/}"
+FILEBASE="${FILENAME%.*}"
+
+convert "${FILE}" \( +clone -background black -shadow 80x20+0+15 \) +swap -background transparent -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png"
diff --git a/dotfiles/scripts/fingerprint b/dotfiles/scripts/fingerprint
new file mode 100755
index 0000000..8e15a98
--- /dev/null
+++ b/dotfiles/scripts/fingerprint
@@ -0,0 +1,66 @@
+#!/usr/bin/env ruby
+
+# Usage exemple: ./fingerprint twitter.com api.twitter.com ton.twitter.com twitter.com tweetdeck.twitter.com userstream.twitter.com abs.twitter.com psb.twimg.com ton.twing.com video.twimg.com 2> /dev/null
+# List of figerprint by domain name
+
+require 'resolv'
+require 'openssl'
+require 'set'
+
+hosts = Set.new
+ips = Set.new
+certs = Set.new
+subjects = Set.new
+cas = Set.new
+fps = Set.new
+keys = Set.new
+
+resolver = Resolv::DNS.new
+ARGV.each do |host|
+ $stderr.puts host
+ hosts << host
+ resolver.each_address(host) do |ip|
+ ip = ip.to_s
+ ips << ip
+ $stderr.puts " #{ip}"
+ tcp_client = TCPSocket.new ip, 443
+ ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client
+ ssl_client.hostname = host
+ ssl_client.connect
+ cert = ssl_client.peer_cert
+ certs << cert
+
+ subject = cert.subject
+ subjects << subject
+ $stderr.puts " CN=#{subject}"
+
+ ca = cert.issuer
+ cas << ca
+ $stderr.puts " CA=#{ca}"
+
+ fp = OpenSSL::Digest::SHA256.hexdigest cert.to_der
+ fps << fp
+ $stderr.puts " fp=#{fp}"
+
+ key = ::OpenSSL::Digest::SHA256.hexdigest cert.public_key.to_der
+ keys << key
+ $stderr.puts " key=#{key}"
+
+ ssl_client.close
+ end
+end
+
+puts "#{hosts.size} hosts"
+hosts.sort.each { |l| puts " #{l}"}
+puts "#{ips.size} IPs"
+ips.sort.each { |l| puts " #{l}"}
+puts "#{fps.size} certificates"
+fps.sort.each { |l| puts " #{l}"}
+puts "#{cas.size} CAs"
+cas.sort.each { |l| puts " #{l}"}
+puts "#{subjects.size} subjects"
+subjects.sort.each { |l| puts " #{l}"}
+puts "#{keys.size} keys"
+keys.sort.each { |l| puts " #{l}"}
+
+
diff --git a/dotfiles/scripts/i3removesupportof.py b/dotfiles/scripts/i3removesupportof.py
new file mode 100755
index 0000000..6cbc877
--- /dev/null
+++ b/dotfiles/scripts/i3removesupportof.py
@@ -0,0 +1,56 @@
+#/bin/python
+
+import re, sys, os
+
+key_to_rm=str(sys.argv[1])
+config_file=os.path.expanduser("~/.config/i3/config")
+
+oneline_conf_file = ""
+
+conf_file_input = open(config_file, 'r')
+
+for line in conf_file_input:
+ line = re.sub("^#{1}\.", "", line)
+ oneline_conf_file = oneline_conf_file + line
+
+conf_file_input.close()
+
+
+# add key
+block_conf_found = re.search(r"#{1}"+key_to_rm+".*#{1}"+key_to_rm+".", oneline_conf_file, re.DOTALL)
+
+if block_conf_found != None:
+
+ block_conf_found_splited = block_conf_found.group(0).splitlines()
+
+ oneline_final_data = ""
+ line_parsed=0
+ comment_this_line=0
+ end_key=0
+ for line in block_conf_found_splited:
+ if re.search("^#{1}"+key_to_rm+"$", line):
+ comment_this_line=1
+ elif re.search("^#{1}"+key_to_rm+".$", line):
+ end_key=1
+ comment_this_line=0
+ if comment_this_line == 1:
+ oneline_final_data = oneline_final_data + "#." + line
+ elif end_key == 1:
+ oneline_final_data = oneline_final_data + "#." + line
+ end_key = 0
+ else:
+ oneline_final_data = oneline_final_data + line
+ if line_parsed != len(block_conf_found_splited)-1:
+ oneline_final_data = oneline_final_data + "\n"
+ line_parsed = line_parsed + 1
+
+
+ oneline_new_conf_file = re.sub(r"#"+key_to_rm+".*#"+key_to_rm+".", oneline_final_data, oneline_conf_file, flags=re.DOTALL)
+
+ confOutput = open(config_file, 'w')
+
+ confOutput.write(oneline_new_conf_file)
+
+ confOutput.close()
+else:
+ print("Sorry the keymap '"+str(sys.argv[1])+"' is not in this conf file, use 'fr' or 'bepo'.\nBetween, this script is used to remove a keymap support for i3wm.\nUsage:\n "+sys.argv[0]+" fr")
diff --git a/dotfiles/scripts/internet-from_wifi_to_internet.sh b/dotfiles/scripts/internet-from_wifi_to_internet.sh
new file mode 100755
index 0000000..83d9b2b
--- /dev/null
+++ b/dotfiles/scripts/internet-from_wifi_to_internet.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#sudo ip addr add 192.168.123.102/24 dev enp3s0
+#sudo ip route add default via 192.168.123.100 dev enp3s0
+
+if [[ $1 == "start" ]]; then
+ /usr/lib/netctl/network start wlp2s0-Livebox-C1D0
+ ip addr add 192.168.123.100/24 dev enp3s0
+ sysctl net.ipv4.ip_forward=1
+ iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE
+ iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
+ iptables -A FORWARD -i enp3s0 -o wlp3s0 -j ACCEPT
+elif [[ $1 == "stop" ]]; then
+ /usr/lib/netctl/network stop wlp2s0-Livebox-C1D0
+ iptables -t nat -D POSTROUTING -o wlp2s0 -j MASQUERADE
+ iptables -D FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
+ iptables -D FORWARD -i enp3s0 -o wlp3s0 -j ACCEPT
+ ip addr del 192.168.123.100/24 dev enp3s0
+ sysctl net.ipv4.ip_forward=0
+else
+ echo "error"
+fi
diff --git a/dotfiles/scripts/ip.sh b/dotfiles/scripts/ip.sh
new file mode 100755
index 0000000..547c451
--- /dev/null
+++ b/dotfiles/scripts/ip.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# sudo apt install dnsutils jq && sudo -H pip3 install speedtest-cli
+
+myip=$(dig +short myip.opendns.com @resolver1.opendns.com)
+geoip=$(curl -s ipinfo.io/"$myip" | jq -r '[.country, .city] | join(", ")')
+
+echo "$myip ($geoip)"
+speedtest-cli --simple --secure
+
+exit 0
+
diff --git a/dotfiles/scripts/launch_rofi-pass.sh b/dotfiles/scripts/launch_rofi-pass.sh
new file mode 100755
index 0000000..87654ce
--- /dev/null
+++ b/dotfiles/scripts/launch_rofi-pass.sh
@@ -0,0 +1 @@
+PINENTRY_USER_DATA="gtk" exec rofi-pass
diff --git a/dotfiles/scripts/lessfilter.sh b/dotfiles/scripts/lessfilter.sh
new file mode 100755
index 0000000..d85c217
--- /dev/null
+++ b/dotfiles/scripts/lessfilter.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+case "$1" in
+ *.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\
+ *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\
+ *.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\
+ *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass)
+ pygmentize -f 256 "$1";;
+ .bashrc|.bash_aliases|.bash_environment)
+ pygmentize -f 256 -l sh "$1"
+ ;;
+ *)
+ grep "#\!/bin/bash" "$1" > /dev/null
+ if [ "$?" -eq "0" ]; then
+ pygmentize -f 256 -l sh "$1"
+ else
+ exit 1
+ fi
+ esac
+
+exit 0
diff --git a/dotfiles/scripts/linux_system_error_list.py b/dotfiles/scripts/linux_system_error_list.py
new file mode 100755
index 0000000..ee1a7a6
--- /dev/null
+++ b/dotfiles/scripts/linux_system_error_list.py
@@ -0,0 +1,46 @@
+#!/bin/python
+
+import re, sys
+from terminaltables import DoubleTable
+
+data = []
+data.append(['Error', 'Code', 'Comment'])
+
+def get_content(file):
+
+ with open(file) as f:
+ content = f.readlines()
+
+ content = [x.strip() for x in content]
+
+ for line in content:
+ if re.search('define',line):
+ line = re.sub('#define\t', '', line)
+ line = re.sub('(?m)^#define .*\n?', '', line)
+ line = re.sub('\t\t', '\t', line)
+ line = re.sub('(/\*|\*/)', '', line)
+ if line != '':
+ data.append(re.split(r'\t',line))
+
+get_content("/usr/include/asm-generic/errno-base.h")
+get_content("/usr/include/asm-generic/errno.h")
+
+if len(sys.argv) == 2 and sys.argv[1] == "list":
+ table = DoubleTable(data, "Error code")
+ table.justify_columns = {0: 'right', 1: 'center', 2: 'left'}
+ print(table.table)
+elif (len(sys.argv) == 2 or len(sys.argv) == 3) and sys.argv[1] == "search":
+ if len(sys.argv) == 3:
+ data_searched = []
+ data_searched.append(['Error', 'Code', 'Comment'])
+ for line in data:
+ if re.search(sys.argv[2],str(line)):
+ data_searched.append(line)
+ table = DoubleTable(data_searched, "Error code")
+ table.justify_columns = {0: 'right', 1: 'center', 2: 'left'}
+ print(table.table)
+ else:
+ print("search <search_string> # You can send regex following re.search python function")
+else:
+ print("search <search_string> # You can send regex following re.search python function")
+ print("list # Return list of all error from errno.h and errno-base.h")
diff --git a/dotfiles/scripts/linux_system_error_list.sh b/dotfiles/scripts/linux_system_error_list.sh
new file mode 100755
index 0000000..4b980d7
--- /dev/null
+++ b/dotfiles/scripts/linux_system_error_list.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cat /usr/include/asm-generic/errno-base.h
+cat /usr/include/asm-generic/errno.h
diff --git a/dotfiles/scripts/mpvbg b/dotfiles/scripts/mpvbg
new file mode 100755
index 0000000..5afba5c
--- /dev/null
+++ b/dotfiles/scripts/mpvbg
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# http://github.com/mitchweaver/bin
+#
+# play a video on the root window
+#
+# Multi screen mode by neodarz
+
+[ -f "$1" ] || exit 1
+
+pkill -9 xwinwrap
+
+readarray -t screen_connected < <(xrandr | grep " connected")
+nb_screen_connected=${#screen_connected[@]}
+for (( num_screen=0; num_screen<$nb_screen_connected; num_screen++)); do
+ screen_geo=$(echo ${screen_connected[num_screen]} | awk '{ print $3 }')
+
+ xwin="xwinwrap -ni -fdt -sh rectangle -un -b -nf -ov -g $screen_geo -- "
+
+ mpv="mpv --wid WID --no-config --keepaspect=no --loop \
+ --no-border --vd-lavc-fast --x11-bypass-compositor=no \
+ --gapless-audio=yes --vo=xv --hwdec=auto --really-quiet \
+ --name=mpvbg"
+
+ $xwin $mpv "$1" > /dev/null 2>&1 &
+ echo -n $! > ${HOME}/.cache/mpvbg-$num_screen.pid
+done
diff --git a/dotfiles/scripts/my-pinentry b/dotfiles/scripts/my-pinentry
new file mode 100755
index 0000000..b46687e
--- /dev/null
+++ b/dotfiles/scripts/my-pinentry
@@ -0,0 +1,16 @@
+#!/bin/bash
+# choose pinentry depending on PINENTRY_USER_DATA
+# requires pinentry-curses and pinentry-gtk2
+# this *only works* with gpg 2
+# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802020
+
+case $PINENTRY_USER_DATA in
+gtk)
+ exec /usr/bin/pinentry-gtk-2 "$@"
+ ;;
+none)
+ exit 1 # do not ask for passphrase
+ ;;
+*)
+ exec /usr/bin/pinentry-curses "$@"
+esac
diff --git a/dotfiles/scripts/notify b/dotfiles/scripts/notify
new file mode 100755
index 0000000..6445914
--- /dev/null
+++ b/dotfiles/scripts/notify
@@ -0,0 +1 @@
+$@ ; twmnc -t "$1" -c "Job end !"
diff --git a/dotfiles/scripts/nullify b/dotfiles/scripts/nullify
new file mode 100755
index 0000000..212c88d
--- /dev/null
+++ b/dotfiles/scripts/nullify
@@ -0,0 +1,2 @@
+#!/bin/sh
+"$@" &>/dev/null
diff --git a/dotfiles/scripts/pyrnotify.py b/dotfiles/scripts/pyrnotify.py
new file mode 100644
index 0000000..53e9c0e
--- /dev/null
+++ b/dotfiles/scripts/pyrnotify.py
@@ -0,0 +1,160 @@
+# -*- coding: utf-8 -*-
+# ex:sw=4 ts=4:ai:
+#
+# Copyright (c) 2012 by Krister Svanlund <krister.svanlund@gmail.com>
+# based on tcl version:
+# Remote Notification Script v1.1
+# by Gotisch <gotisch@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Example usage when Weechat is running on a remote PC and you want
+# want to use port 4321 for the connection.
+#
+# On the "client" (where the notifications will end up), host is
+# the remote host where weechat is running:
+# python2 location/of/pyrnotify.py 4321 & ssh -R 4321:localhost:4321 username@host
+# You can have a second argument to specified the time to display the notification
+# python2 location/of/pyrnotify.py 4321 2000 & ssh -R 4321:localhost:4321 username@host
+# Important to remember is that you should probably setup the
+# connection with public key encryption and use something like
+# autossh to do this in the background.
+#
+# In weechat:
+# /python load pyrnotify.py
+# and set the port
+# /set plugins.var.python.pyrnotify.port 4321
+#
+# It is also possible to set which host pyrnotify shall connect to,
+# this is not recommended. Using a ssh port-forward is much safer
+# and doesn't require any ports but ssh to be open.
+
+# ChangeLog:
+#
+# 2014-05-10: Change hook_print callback argument type of displayed/highlight
+# (WeeChat >= 1.0)
+# 2012-06-19: Added simple escaping to the title and body strings for
+# the script to handle trailing backslashes.
+
+try:
+ import weechat as w
+ in_weechat = True
+except ImportError as e:
+ in_weechat = False
+
+import os, sys, re
+import socket
+import subprocess
+import shlex
+
+SCRIPT_NAME = "pyrnotify"
+SCRIPT_AUTHOR = "Krister Svanlund <krister.svanlund@gmail.com>"
+SCRIPT_VERSION = "1.0"
+SCRIPT_LICENSE = "GPL3"
+SCRIPT_DESC = "Send remote notifications over SSH"
+
+def escape(s):
+ return re.sub(r'([\\"\'])', r'\\\1', s)
+
+def run_notify(icon, nick,chan,message):
+ host = w.config_get_plugin('host')
+ try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((host, int(w.config_get_plugin('port'))))
+ s.send("normal %s \"%s to %s\" \"%s\"" % (icon, nick, escape(chan), escape(message)))
+ s.close()
+ except Exception as e:
+ w.prnt("", "Could not send notification: %s" % str(e))
+
+def on_msg(*a):
+ if len(a) == 8:
+ data, buffer, timestamp, tags, displayed, highlight, sender, message = a
+ if data == "private" or int(highlight):
+ if data == "private" and w.config_get_plugin('pm-icon'):
+ icon = w.config_get_plugin('pm-icon')
+ else:
+ icon = w.config_get_plugin('icon')
+ buffer = "me" if data == "private" else w.buffer_get_string(buffer, "short_name")
+ run_notify(icon, sender, buffer, message)
+ #w.prnt("", str(a))
+ return w.WEECHAT_RC_OK
+
+def weechat_script():
+ settings = {'host' : "localhost",
+ 'port' : "4321",
+ 'icon' : "utilities-terminal",
+ 'pm-icon' : "emblem-favorite"}
+ if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
+ for (kw, v) in settings.items():
+ if not w.config_get_plugin(kw):
+ w.config_set_plugin(kw, v)
+ w.hook_print("", "notify_message", "", 1, "on_msg", "")
+ w.hook_print("", "notify_private", "", 1, "on_msg", "private")
+ w.hook_print("", "notify_highlight", "", 1, "on_msg", "") # Not sure if this is needed
+
+
+
+
+
+
+######################################
+## This is where the client starts, except for the global if-check nothing below this line is
+## supposed to be executed in weechat, instead it runs when the script is executed from
+## commandline.
+
+def accept_connections(s, timeout=None):
+ conn, addr = s.accept()
+ try:
+ data = ""
+ d = conn.recv(1024)
+ while d:
+ data += d
+ d = conn.recv(1024)
+ finally:
+ conn.close()
+ if data:
+ try:
+ urgency, icon, title, body = shlex.split(data)
+ if timeout:
+ #subprocess.call(["/usr/bin/twmnc", "-t", timeout, "-u", urgency, "-c", "IRC", "-i", icon, escape(title), escape(body)])
+ subprocess.call(["/usr/bin/twmnc", "-t", escape(title), "-c", escape(body)])
+ else:
+ #subprocess.call(["/usr/bin/twmnc", "-u", urgency, "-c", "IRC", "-i", icon, escape(title), escape(body)])
+ subprocess.call(["/usr/bin/twmnc", "-t", "IRC", "-c", escape(title), escape(body)])
+
+ except ValueError as e:
+ print e
+ except OSError as e:
+ print e
+ accept_connections(s, timeout)
+
+def weechat_client(argv):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ s.bind(("localhost", int(argv[1] if len(sys.argv) > 1 else 4321)))
+ s.listen(5)
+ try:
+ accept_connections(s, argv[2] if len(sys.argv) > 2 else None)
+ except KeyboardInterrupt as e:
+ print "Keyboard interrupt"
+ print e
+ finally:
+ s.close()
+
+if __name__ == '__main__':
+ if in_weechat:
+ weechat_script()
+ else:
+ weechat_client(sys.argv)
diff --git a/dotfiles/scripts/searx.sh b/dotfiles/scripts/searx.sh
new file mode 100755
index 0000000..876d6d1
--- /dev/null
+++ b/dotfiles/scripts/searx.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+sudo systemctl start httpd.service
+python /srv/searx/searx/webapp.py
diff --git a/dotfiles/scripts/ssh.sh b/dotfiles/scripts/ssh.sh
new file mode 100755
index 0000000..7116490
--- /dev/null
+++ b/dotfiles/scripts/ssh.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#By default the sshd listen only for local connection.
+
+if [[ $1 == "disable" ]]; then
+ if [[ $(cat /etc/ssh/sshd_config | grep -e "^ListenAddress") == "" ]]; then
+ sudo sed -i -e 's/#ListenAddress ::/#ListenAddress ::\nListenAddress 127.0.0.1/g' /etc/ssh/sshd_config
+ sudo systemctl restart sshd.service
+ fi
+ echo "sshd listen now only for local address 127.0.0.1."
+elif [[ $1 == "enable" ]]; then
+ sudo sed -i -e '/ListenAddress 127.0.0.1/d' /etc/ssh/sshd_config
+ sudo systemctl restart sshd.service
+ echo "sshd listen now for all address."
+elif [[ $1 == "status" ]]; then
+ echo $(sudo systemctl status sshd.service)
+ echo "sshd conf say:"
+ echo $(cat /etc/ssh/sshd_config | grep -e "^ListenAddress")
+elif [[ $1 == "start" || $1 == "stop" || $1 == "restart" ]]; then
+ sudo systemctl $1 sshd.service
+fi
+
+sudo -k
+
diff --git a/dotfiles/scripts/switch-workspace.py b/dotfiles/scripts/switch-workspace.py
new file mode 100755
index 0000000..d311c46
--- /dev/null
+++ b/dotfiles/scripts/switch-workspace.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+from json import loads
+from os import popen
+from sys import argv
+
+def ipc_query(req="command", msg=""):
+ ans = popen("i3-msg -t " + req + " " + msg).readlines()[0]
+ return loads(ans)
+
+if __name__ == "__main__":
+ # Usage & checking args
+ if len(argv) != 2:
+ print ("Usage: switch-workspace.py name-of-workspace")
+ exit(-1)
+
+ newworkspace = argv[1]
+
+ # Retrieving active display
+ active_display = None
+ old_display = None
+ for w in ipc_query(req="get_workspaces"):
+ if w['focused']:
+ active_display = w['output']
+ if w['name'] == newworkspace:
+ old_display = w['output']
+ if newworkspace.isdigit() and w['num'] == int(newworkspace):
+ old_display = w['output']
+ print (w)
+
+ # Pre-computing commands
+ if newworkspace.isdigit():
+ cmd_show = "workspace number " + newworkspace
+ else:
+ cmd_show = "workspace " + newworkspace
+ cmd_move = "move workspace to output " + active_display
+
+ # Moving workspace to active display
+ if active_display == old_display:
+ print (cmd_show)
+ print (ipc_query(msg=cmd_show))
+ else:
+ cmd="'" + cmd_show + ";" + cmd_move + ";" + cmd_show + "'"
+ print (cmd)
+ print (ipc_query(msg=cmd))
diff --git a/dotfiles/scripts/switch_audio.sh b/dotfiles/scripts/switch_audio.sh
new file mode 100755
index 0000000..aff2543
--- /dev/null
+++ b/dotfiles/scripts/switch_audio.sh
@@ -0,0 +1,16 @@
+#/bin/sh
+
+# Usage :
+# switch_audio.sh <sinkport_number>
+
+headphones="analog-output-headphones"
+lineout="analog-output-lineout"
+sinkport="$1"
+
+if [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $lineout ]]
+then
+ pacmd set-sink-port $sinkport $headphones
+ elif [[ $(echo $(pacmd list | grep "active port") | cut -d" " -f3 | cut -d"<" -f2 | cut -d">" -f1) == $headphones ]]
+ then
+ pacmd set-sink-port $sinkport $lineout
+ fi
diff --git a/dotfiles/scripts/task b/dotfiles/scripts/task
new file mode 100755
index 0000000..f15e4a6
--- /dev/null
+++ b/dotfiles/scripts/task
@@ -0,0 +1,28 @@
+#!/bin/sh
+SESSION=task
+
+optios $@
+
+tmux kill-session -t $SESSION
+tmux -2 new-session -d -s $SESSION
+tmux send-keys "watch task calendar" C-m
+tmux split-window -v
+tmux resize-pan -D 10
+tmux resize-pan -U 10
+tmux send-keys "watch task $@" C-m
+tmux split-window -v
+tmux resize-pan -D 20
+tmux resize-pan -U 5
+l1="┳━┓┓ ┃┳━┓┏┏┓┳━┓┳ ┳━┓ ┏━┓┳━┓ ┓━┓┏━┓┏┏┓┳━┓ ┏━┓┏━┓┏┏┓┏┏┓┳━┓┏┓┓┳━┓┓━┓"
+l2="┣━ ┏╋┛┃━┫┃┃┃ ┃━┛┃ ┣━ ┃ ┃┣━ ┗━┓┃ ┃┃┃┃ ┣━ ┃ ┃ ┃┃┃┃ ┃┃┃ ┃━┫┃┃┃┃ ┃┗━┓"
+l3="┻━┛┇ ┗┛ ┇┛ ┇┇ ┇━┛┻━┛ ┛━┛┇ ━━┛┛━┛┛ ┇┻━┛ ┗━┛┛━┛┛ ┇┛ ┇┛ ┇┇┗┛┇━┛━━┛"
+tmux send-keys "clear;echo -e '$l1\n$l2\n$l3\n\ntmux send-keys -t task:0.1 C-c \`<watch task>\` C-m\nMore info about task on the next page !'" C-m
+tmux split-window -v
+tmux resize-pan -D 5
+tmux new-window
+tmux select-window -t 1
+tmux send-keys "task help | less" C-m
+tmux select-window -t 0
+tmux rename-window -t 0 "task"
+tmux rename-window -t 1 "help"
+tmux -2 attach-session -t $SESSION
diff --git a/dotfiles/scripts/tdone b/dotfiles/scripts/tdone
new file mode 100755
index 0000000..d63fd87
--- /dev/null
+++ b/dotfiles/scripts/tdone
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+usage () {
+ echo "Usage:"
+ echo " tdone <option> <date>"
+ echo "Date list:"
+ echo " today - Show the tasks done today"
+ echo " yesterday - Show the tasks done yesterday"
+ echo " week - Show the tasks done this week"
+ echo " month - Show the tasks done this month"
+ echo "Option list:"
+ echo " -h view this help message"
+ }
+
+if [[ $1 == "today" ]]; then
+ task end.after:today completed
+elif [[ $1 == "yesterday" ]]; then
+ task end.after:today-1d completed
+elif [[ $1 == "month" ]]; then
+ task end.after:socm completed
+elif [[ $1 == "week" ]]; then
+ task end.after:socw completed
+elif [[ $@ =~ ^[[:digit:][:space:]]*$ ]]; then
+ task modify -next $@; task done $@
+elif [[ $1 == "-h" ]]; then
+ usage
+else
+ echo "Wrong option/date"
+ echo "Write 'tdone -h' for help"
+fi
diff --git a/dotfiles/scripts/tm.sh b/dotfiles/scripts/tm.sh
new file mode 100755
index 0000000..851cd7e
--- /dev/null
+++ b/dotfiles/scripts/tm.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# source https://github.com/Drakirus/dotfiles/blob/master/bin/tm
+# abort if we're already inside a TMUX session
+if [ "$TMUX" != "" ]; then
+ echo "Already inside a TMUX session !!"
+ exit 1
+fi
+# startup a "default" session if non currently exists
+# tmux has-session -t _default || tmux new-session -s _default -d
+
+
+SessionNb=$( tmux list-sessions -F "#S" 2>/dev/null | wc -l )
+if [ $SessionNb -eq 0 ]; then
+ # read -p "Enter new session name: " SESSION_NAME
+ TERM=screen-256color-bce tmux new -s "Start" #"$SESSION_NAME"
+else
+ # present menu for user to choose which workspace to open
+ PS3="Please choose your session: "
+ options=($(tmux list-sessions -F "#S" 2>/dev/null) "New Session" "Independent attach")
+ echo "Available Options"
+ echo "------------------"
+ echo " "
+ select opt in "${options[@]}"
+ do
+ case $opt in
+ "New Session")
+ read -p "Enter new session name: " SESSION_NAME
+ TERM=screen-256color-bce tmux new -s "$SESSION_NAME"
+ break
+ ;;
+
+ "Independent attach")
+ optionsATTACH=($(tmux list-sessions -F "#S" 2>/dev/null))
+ echo " "
+ echo "Available sessions"
+ echo "------------------"
+ select optATT in "${optionsATTACH[@]}"
+ do
+ TERM=screen-256color-bce tmux new -s "Agent_infiltré" -t $optATT
+ exit 0
+ done
+ ;;
+ *)
+ TERM=screen-256color-bce tmux attach-session -t $opt
+ break
+ ;;
+ esac
+ done
+fi
diff --git a/dotfiles/scripts/watch b/dotfiles/scripts/watch
new file mode 100755
index 0000000..b40c0af
--- /dev/null
+++ b/dotfiles/scripts/watch
@@ -0,0 +1,12 @@
+#!/bin/bash
+command=$@
+
+clear
+
+while true
+do
+ eval "$command"
+ sleep 1
+ echo -n -e "$clearline"
+ clear
+done
diff --git a/dotfiles/scripts/weechat_notify.sh b/dotfiles/scripts/weechat_notify.sh
new file mode 100755
index 0000000..49bef0c
--- /dev/null
+++ b/dotfiles/scripts/weechat_notify.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+if [[ $1 == "start" ]]; then
+ python2 ~/.scripts/pyrnotify.py 4323 &
+ ssh -fNT -R 4323:localhost:4323 neodarz@neodarz.net -p 19977
+elif [[ $1 == "stop" ]]; then
+ sudo kill -9 $(ps aux | grep pyrnotify.py | awk '{print $2}')
+ sudo kill -9 $(ps aux | grep " ssh -fNT -R 4323:localhost:4323 neodarz@neodarz.net -p 19977" | awk '{print $2}')
+fi
+
+
+
diff --git a/dotfiles/scripts/what.sh b/dotfiles/scripts/what.sh
new file mode 100755
index 0000000..2055f70
--- /dev/null
+++ b/dotfiles/scripts/what.sh
@@ -0,0 +1,42 @@
+key='h'
+while [[ $key != 'q' ]]
+do
+echo ""
+echo "╓───────────────────────[ Map ]─[ i3 ]"
+echo "╙──────────────────────────────────────────────────────── ─ ─"
+echo "╓──────────────────────────────────────────────────────────────────────────────────────╖"
+echo "║ ║"
+echo "║ ┌ ┐ ║"
+echo "║ LEFT · SCREEN ║"
+echo "║ └ ┘ ║"
+echo "║ ║"
+echo "║ (Go to) [WinKey]+[n] ║"
+echo "║ (Mv to) [WinKey]+[Shift]+[n] ║"
+echo "║ ║"
+echo "╙──────[1:CHAT]─[2:MAIL]─[3:TERM]─[4:TERM]─[5:DOC]─[6:SRV]─[7]─[8]─[9]─[10:TRASH]──────╜"
+
+echo "╓──────────────────────────────────────────────────────────────────────────────────────╖"
+echo "║ ║"
+echo "║ ┌ ┐ ║"
+echo "║ CENTER · SCREEN ║"
+echo "║ └ ┘ ║"
+echo "║ ║"
+echo "║ (Go to) [WinKey]+[Control]+[n] ║"
+echo "║ (Mv to) [Control]+[AltKey]+[n] ║"
+echo "║ ║"
+echo "╙─[11:WEB]─[12:GAME]─[13:TERM]─[14:TERM]─[15:CODE]─[16:FILM]─[17:MUSIC]─[18]─[19]─[20]─╜"
+
+echo "╓──────────────────────────────────────────────────────────────────────────────────────╖"
+echo "║ ║"
+echo "║ ┌ ┐ ║"
+echo "║ RIGHT · SCREEN ║"
+echo "║ └ ┘ ║"
+echo "║ ║"
+echo "║ (Go to) [WinKey]+[AltKey]+[n] ║"
+echo "║ (Mv to) [WinKey]+[Control]+[AltKey]+[n] ║"
+echo "║ ║"
+echo "╙─────────[21:WEB]─[22]─[23:TERM]─[24:TERM]─[25]─[26]─[27]─[28]─[29]─[30:TRASH]────────╜"
+
+read -n1 -r key
+
+done
diff --git a/dotfiles/scripts/what_alias.sh b/dotfiles/scripts/what_alias.sh
new file mode 100755
index 0000000..4b79640
--- /dev/null
+++ b/dotfiles/scripts/what_alias.sh
@@ -0,0 +1,56 @@
+key='h'
+while [[ $key != 'q' ]]
+do
+echo ""
+echo "╓───────────────────────[ alias list ]─[ i3 ]"
+echo "╙──────────────────────────────────────────────────────── ─ ─"
+echo "╓──────────────────────────────────────────────────────────────────────────────────────╖"
+echo "║ l -> ls -F --color=auto ll -> ls -lhF --color=auto ║"
+echo "║ la -> ls -lahF --color=auto .. -> cd .. ║"
+echo "║ ... -> cd ../.. ../.. -> cd ../.. ║"
+echo "║ rmrf -> rm -rf psef -> ps -ef ║"
+echo "║ mkdir -> mkdir -p cp -> cp -r ║"
+echo "║ scp -> scp -r xsel -> xsel -b ║"
+echo "║ fuck -> sudo \$(fc -ln -1) v/vi/emacs -> vim ║"
+echo "║ g -> git ga -> git add ║"
+echo "║ gc -> git commit -m gcs -> git commit -S -m ║"
+echo "║ gs -> git status gd -> git diff ║"
+echo "║ gm -> git merge gr -> git rebase ║"
+echo "║ gp -> git push gu -> git pull ║"
+echo "║ gco -> git checkout gcs -> git commit -S -m ║"
+echo "║ gap -> git add -p matrix -> cmatrix -b ║"
+echo "║ ag -> search in code tree -> tree with cool options ║"
+echo "║ tempwatch -> sensors in while loop toiletlist -> toilet list font ║"
+echo "║ future -> generate font text pacman -> sudo pacman ║"
+echo "║ lol -> lolcat update -> yaourt -Syu ║"
+echo "║ off -> poweroff ZZ -> quit ║"
+echo "║ dldstart -> aria2d start dldstop -> aria2d stop ║"
+echo "║ dldstatus -> aria2d status dll -> list torrents dls ║"
+echo "║ dllw -> watch list torrent dls dla -> add torrent ║"
+echo "║ diana -> use diana with tocken dlrm -> rm torrent ║"
+echo "║ dlrs -> resume torrent dlp -> pause torrent ║"
+echo "║ disks -> disks info record -> record current screen ║"
+echo "║ nullify -> no fucking output log ff -> firefox-developer nullified ║"
+echo "║ lo -> libreoffice nullified le -> colorized less ║"
+echo "║ fixit -> fixi pacman db printer -> system-config-printer ║"
+echo "║ bat -> show bat % rl -> source zsh alias ║"
+echo "║ rssyoutube -> youtube rss rssblog -> blogs rss ║"
+echo "║ i3lock -> i3lock-fancy weatherMans -> . ║"
+echo "║ weatherChap -> . vpn -> vpn fait maison ║"
+echo "║ cal -> ikhal cals -> sync cals ║"
+echo "║ mm -> sync and mutt tm -> attach tmux session X ║"
+echo "║ mdm -> read md file like manpage mixer -> alsamixer ║"
+echo "║ t -> task ts -> task sync ║"
+echo "║ tcal -> task calendar thistory -> task history ║"
+echo "║ thgraphdaily -> task burndown.daily tgraphweek -> task burndown.week ║"
+echo "║ tgraphmonth -> task burndown.week tnext -> get the next tasks ║"
+echo "║ tdone -> . tactive -> . ║"
+echo "║ tlistprojects -> . tlistallprojects -> . ║"
+echo "║ c -> colorized cat stowroot -> sudo stow -t / ║"
+echo "║ ║"
+echo "║ email <to> <subject> <text> ║"
+echo "╙──────────────────────────────────────────────────────────────────────────────────────╜"
+
+read -n1 -r key
+
+done
diff --git a/dotfiles/scripts/what_command_help.sh b/dotfiles/scripts/what_command_help.sh
new file mode 100755
index 0000000..7c5eddd
--- /dev/null
+++ b/dotfiles/scripts/what_command_help.sh
@@ -0,0 +1,40 @@
+key='h'
+while [[ $key != 'q' ]]
+do
+echo ""
+echo "╓───────────────────────[ cmds list ]─[ i3 ]"
+echo "╙──────────────────────────────────────────────────────── ─ ─"
+echo "╓──────────────────────────────────────────────────────────────────────────────────────╖"
+echo "║ · Help keys ║"
+echo "║ [WinKey+h] cmds list [AltKey+h] screen map ║"
+echo "║ [WinKey+a] alias map ║"
+echo "║ ║"
+echo "║ · screen keys ║"
+echo "║ [XF86MonBrightnessUp] backlight +1 [XF86MonBrightnessDown] backlight -1 ║"
+echo "║ ║"
+echo "║ · audio keys ║"
+echo "║ [XF86AudioMute] mute toggle [XF86AudioPlay] output toggle ║"
+echo "║ [XF86AudioLowerVolume] vol -1% [XF86AudioRaiseVolume] vol +1% ║"
+echo "║ [WinKey+control+m] mic toggle ║"
+echo "║ ║"
+echo "║ · keys ║"
+echo "║ [WinKey+control+l] lock [WinKey+o] screenshot ║"
+echo "║ ║"
+echo "║ · app keys ║"
+echo "║ [WinKey+Shift+F1] ranger [WinKey+Shift+F2] cmus ║"
+echo "║ [WinKey+Shift+F3] mutt × [WinKey+Shift+F4] mosh neodarz.net × ║"
+echo "║ [WinKey+Shift+F4] mosh neodarz.net × [WinKey+Shift+F5] firefox-dev ║"
+echo "║ [WinKey+Shift+F6] atom × [WinKey+Shift+F7] ncmpcpp ║"
+echo "║ [WinKey+Shift+F8] qutebrowser × ║"
+echo "║ ║"
+echo "║ · launcher keys ║"
+echo "║ [WinKey+p] passmenu [WinKey+Return] qterminal ║"
+echo "║ [WinKey+d] dmenu ║"
+echo "║ ║"
+echo "║ ║"
+echo "║ ║"
+echo "╙──────────────────────────────────────────────────────────────────────────────────────╜"
+
+read -n1 -r key
+
+done
diff --git a/dotfiles/scripts/working.sh b/dotfiles/scripts/working.sh
new file mode 100755
index 0000000..d7484c6
--- /dev/null
+++ b/dotfiles/scripts/working.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+tmuxp load /$HOME/.scripts/working_tmux.yaml
diff --git a/dotfiles/scripts/working_tmux.yaml b/dotfiles/scripts/working_tmux.yaml
new file mode 100644
index 0000000..d2bc453
--- /dev/null
+++ b/dotfiles/scripts/working_tmux.yaml
@@ -0,0 +1,15 @@
+session_name: work
+windows:
+- window_name: all
+ layout: main-horizontal
+ options:
+ main-pane-height: 35
+ shell_command_before:
+ - cd ~/ # run as a first command in all panes
+ panes:
+ - shell_command:
+ - weechat
+ focus: true
+ - clear; work
+ - cals
+ - clear; t
diff --git a/dotfiles/scripts/write_on_disk.rb b/dotfiles/scripts/write_on_disk.rb
new file mode 100644
index 0000000..dc6f280
--- /dev/null
+++ b/dotfiles/scripts/write_on_disk.rb
@@ -0,0 +1,63 @@
+
+
+ #!/usr/bin/env ruby
+ require 'dbus'
+ require 'awesome_print'
+ require 'filesize'
+ require 'colorize'
+
+ loop = DBus::Main.new
+ bus = DBus::SystemBus.instance
+
+ udisk2 = bus['org.freedesktop.UDisks2']
+ device = nil
+
+ EXPECTED_INTERFACES = %w[org.freedesktop.UDisks2.PartitionTable org.freedesktop.UDisks2.Block]
+
+ manager = udisk2['/org/freedesktop/UDisks2']['org.freedesktop.DBus.ObjectManager']
+ manager.on_signal 'InterfacesAdded' do |path|
+ interfaces = udisk2[path].interfaces
+ next unless (EXPECTED_INTERFACES - interfaces).empty?
+ block = udisk2[path]['org.freedesktop.UDisks2.Block']
+
+ path = path.split('/').last
+
+ drive = block['Drive']
+ drive = udisk2[drive]['org.freedesktop.UDisks2.Drive']
+ id = drive['Id']
+ size = Filesize.new drive['Size']
+
+ device = { path: path, id: id, size: size }
+
+ loop.quit
+ end
+
+ iso = ARGV.first
+ size = File.size iso
+ puts "#{'Plug a drive'.colorize :red} to begin to write #{iso.colorize :green} [#{Filesize.new(size).pretty.colorize :yellow}]"
+
+ loop << bus
+ loop.run
+
+ print "Erase #{device[:id].colorize :red} [#{device[:size].pretty.colorize :yellow}]? [y/N] "
+ answer = STDIN.gets.chomp
+
+ exit -1 unless answer.downcase == 'y'
+ device = File.join '/dev/', device[:path]
+ current = 0
+ chunk = Filesize.from('4MiB').to_i
+
+ File.open iso, 'rb' do |iso|
+ File.open device, 'wb' do |device|
+ while read = iso.read(chunk) do
+ current += read.size
+ device.write read
+ print "\r[%6.2f%%] %d/%d" % [current.to_f / size * 100, current, size]
+ end
+ puts
+ puts 'Finalizing...'.colorize :yellow
+ end
+ end
+ puts 'Done!'.colorize :green
+
+
diff --git a/dotfiles/scripts/zsh_aliases_functions.sh b/dotfiles/scripts/zsh_aliases_functions.sh
new file mode 100755
index 0000000..c6ac167
--- /dev/null
+++ b/dotfiles/scripts/zsh_aliases_functions.sh
@@ -0,0 +1,6 @@
+# fetch all zsh aliases
+alias | awk -F'[ =]' '{print $1}'
+
+# fetch all zsh functions
+# http://superuser.com/questions/681575/any-way-to-get-list-of-functions-defined-in-zsh-like-alias-command-for-aliases
+#print -l ${(ok)functions}