parent
0f80079368
commit
55a7d2da4f
12 changed files with 258 additions and 44 deletions
@ -0,0 +1,3 @@ |
||||
#!/usr/bin/env bash |
||||
source $HOME/.dotfiles/shells/zsh/current-color-scheme |
||||
vim "$@" |
@ -0,0 +1,71 @@ |
||||
#!/bin/bash |
||||
trap "tput reset; tput cnorm; exit" 2 |
||||
clear |
||||
tput civis |
||||
lin=2 |
||||
col=$(($(tput cols) / 2)) |
||||
c=$((col-1)) |
||||
est=$((c-2)) |
||||
color=0 |
||||
tput setaf 2; tput bold |
||||
|
||||
# Tree |
||||
for ((i=1; i<20; i+=2)) |
||||
{ |
||||
tput cup $lin $col |
||||
for ((j=1; j<=i; j++)) |
||||
{ |
||||
echo -n \* |
||||
} |
||||
let lin++ |
||||
let col-- |
||||
} |
||||
|
||||
tput sgr0; tput setaf 3 |
||||
|
||||
# Trunk |
||||
for ((i=1; i<=2; i++)) |
||||
{ |
||||
tput cup $((lin++)) $c |
||||
echo 'mWm' |
||||
} |
||||
new_year=$(date +'%Y') |
||||
let new_year++ |
||||
tput setaf 1; tput bold |
||||
tput cup $lin $((c - 8)); echo MERRY CHRISTMAS IRM |
||||
tput cup $((lin + 1)) $((c - 12)); echo And lots of HACKING in $new_year |
||||
let c++ |
||||
k=1 |
||||
|
||||
# Lights and decorations |
||||
while true; do |
||||
for ((i=1; i<=35; i++)) { |
||||
# Turn off the lights |
||||
[ $k -gt 1 ] && { |
||||
tput setaf 2; tput bold |
||||
tput cup ${line[$[k-1]$i]} ${column[$[k-1]$i]}; echo \* |
||||
unset line[$[k-1]$i]; unset column[$[k-1]$i] # Array cleanup |
||||
} |
||||
|
||||
li=$((RANDOM % 9 + 3)) |
||||
start=$((c-li+2)) |
||||
co=$((RANDOM % (li-2) * 2 + 1 + start)) |
||||
tput setaf $color; tput bold # Switch colors |
||||
tput cup $li $co |
||||
echo o |
||||
line[$k$i]=$li |
||||
column[$k$i]=$co |
||||
color=$(((color+1)%8)) |
||||
# Flashing text |
||||
sh=-1 |
||||
for l in H A C K I N G |
||||
do |
||||
tput cup $((lin+1)) $((c+sh)) |
||||
echo $l |
||||
let sh++ |
||||
sleep 0.01 |
||||
done |
||||
} |
||||
k=$((k % 2 + 1)) |
||||
done |
||||
reset |
@ -1,3 +1,52 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
notify-send "$(date '+%T')" "$(date '+%A %d %B %Y')" |
||||
function round() { |
||||
echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc)) |
||||
} |
||||
|
||||
function drawBar(){ |
||||
local percent=$1; |
||||
|
||||
for i in {1..10}; do |
||||
local boxPercent=$(($i*10)) |
||||
if [ "$boxPercent" -lt "$percent" ]; then |
||||
echo -n "■" |
||||
elif [ "$boxPercent" -eq "$percent" ]; then |
||||
echo -n "■" |
||||
elif [ "$(($boxPercent-10))" -lt "$percent" ]; then |
||||
echo -n "▣" |
||||
else |
||||
echo -n "□" |
||||
fi |
||||
done |
||||
|
||||
} |
||||
|
||||
function getTimer(){ |
||||
if [ -e "$HOME/timer" ]; then |
||||
local humanDuration=$(head -n 1 "$HOME/timer") |
||||
# All these dates are in seconds since the epoch |
||||
local duration=$(( $(date -d "now + $humanDuration" '+%s') - $(date '+%s') )) |
||||
local startTime=$(stat --format="%Y" "$HOME/timer") |
||||
local endTime=$(( $startTime + $duration )) |
||||
local currentTime=$(date '+%s') |
||||
|
||||
if [ $endTime -gt $currentTime ]; then |
||||
|
||||
local percentage=$(echo " ( ( $currentTime - $startTime ) * 100 ) / ( $endTime - $startTime ) " | bc ) |
||||
|
||||
echo -n "$percentage% " |
||||
echo $(drawBar $percentage) |
||||
fi |
||||
|
||||
|
||||
fi |
||||
} |
||||
|
||||
time=$(date '+%T') |
||||
date=$(date '+%A %d %B %Y') |
||||
timer="$(getTimer)" |
||||
|
||||
|
||||
|
||||
notify-send "$time" "$date\n$timer$1" |
||||
|
@ -0,0 +1,32 @@ |
||||
#!/usr/bin/env python |
||||
|
||||
from __future__ import print_function |
||||
import pyclbr |
||||
import sys |
||||
import operator |
||||
|
||||
if __name__ == '__main__': |
||||
modname = sys.argv[2] |
||||
methname = sys.argv[1] |
||||
|
||||
mod = pyclbr.readmodule(modname) |
||||
for clsname, cls in mod.items(): |
||||
if methname in cls.methods: |
||||
print("Method: {} in Class: {}".format(methname, clsname)) |
||||
methods = sorted(cls.methods.items(), key=operator.itemgetter(1)) |
||||
clsfile = open(cls.file, 'r') |
||||
break |
||||
|
||||
for pair in methods: |
||||
name, lineno = pair |
||||
if name == methname: |
||||
startline = lineno |
||||
if methods.index(pair) == methods.index(methods[-1]): |
||||
endline = None |
||||
else: |
||||
endline = methods[methods.index(pair) + 1][1] |
||||
break |
||||
|
||||
src = clsfile.readlines()[startline-1:endline-1 if endline is not None else -1] |
||||
for srcline in src: |
||||
print(srcline, end='') |
@ -0,0 +1,2 @@ |
||||
#!/bin/sh |
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal |
@ -0,0 +1,24 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
echo "$@" > "$HOME/timer" |
||||
|
||||
|
||||
humanDuration=$(head -n 1 "$HOME/timer") |
||||
# All these dates are in seconds since the epoch |
||||
duration=$(( $(date -d "now + $humanDuration" '+%s') - $(date '+%s') )) |
||||
|
||||
# Display date time notification when half way |
||||
( sleep $(( duration / 2 )) |
||||
datetime |
||||
) & disown |
||||
|
||||
# Display date time notification when 90% done |
||||
( sleep $(( (duration * 9) / 10 )) |
||||
datetime |
||||
) & disown |
||||
|
||||
# Display date time notification when half way |
||||
( sleep $duration |
||||
datetime "Finished" |
||||
) & disown |
||||
|
@ -0,0 +1,9 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
domain="$1" |
||||
|
||||
if [ -z "$domain" ]; |
||||
echo "You need to give a domain or ip address" |
||||
fi |
||||
|
||||
if |
Loading…
Reference in new issue