aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNeodarZ <neodarz@neodarz.net>2017-08-23 20:35:04 +0200
committerNeodarZ <neodarz@neodarz.net>2017-08-23 20:35:04 +0200
commit8dab54a65a713d7bf661bc966e58c7e8ecf9c408 (patch)
treed945c2db604bb2243aa59ab9da38c472985ef5ea /scripts
parent58fe5cf21035b556cab6577bd0ebc294d0df621f (diff)
downloaddotfiles_ascii-8dab54a65a713d7bf661bc966e58c7e8ecf9c408.tar.xz
dotfiles_ascii-8dab54a65a713d7bf661bc966e58c7e8ecf9c408.zip
Add some cool script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/.scripts/fingerprint66
-rwxr-xr-xscripts/.scripts/lessfilter.sh20
-rwxr-xr-xscripts/.scripts/nullify2
-rwxr-xr-xscripts/.scripts/task28
-rwxr-xr-xscripts/.scripts/tdone28
-rwxr-xr-xscripts/.scripts/watch12
6 files changed, 156 insertions, 0 deletions
diff --git a/scripts/.scripts/fingerprint b/scripts/.scripts/fingerprint
new file mode 100755
index 0000000..8e15a98
--- /dev/null
+++ b/scripts/.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/scripts/.scripts/lessfilter.sh b/scripts/.scripts/lessfilter.sh
new file mode 100755
index 0000000..d85c217
--- /dev/null
+++ b/scripts/.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/scripts/.scripts/nullify b/scripts/.scripts/nullify
new file mode 100755
index 0000000..212c88d
--- /dev/null
+++ b/scripts/.scripts/nullify
@@ -0,0 +1,2 @@
+#!/bin/sh
+"$@" &>/dev/null
diff --git a/scripts/.scripts/task b/scripts/.scripts/task
new file mode 100755
index 0000000..f15e4a6
--- /dev/null
+++ b/scripts/.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/scripts/.scripts/tdone b/scripts/.scripts/tdone
new file mode 100755
index 0000000..35fe01d
--- /dev/null
+++ b/scripts/.scripts/tdone
@@ -0,0 +1,28 @@
+#!/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 [[ $1 == "-h" ]]; then
+ usage
+else
+ echo "Wrong option/date"
+ echo "Write 'tdone -h' for help"
+fi
diff --git a/scripts/.scripts/watch b/scripts/.scripts/watch
new file mode 100755
index 0000000..b40c0af
--- /dev/null
+++ b/scripts/.scripts/watch
@@ -0,0 +1,12 @@
+#!/bin/bash
+command=$@
+
+clear
+
+while true
+do
+ eval "$command"
+ sleep 1
+ echo -n -e "$clearline"
+ clear
+done