View fun-fact-ory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function FunFactOry(token:string, s1:string, s2:number, s3:number):string { | |
switch (token) { | |
case "#funfact_ace": | |
return `Ace! ${s1} killed the entire enemy team.`; | |
case "#funfact_best_accuracy": | |
if (s3) { | |
return `${s1} had an accuracy of ${s3}%.`; | |
} |
View process-bunlde.zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download the bundle.json by watching for a XHR request in your browsers console that contains the bundle data | |
# The request to watch for has a 16 byte random file name and a complex json sturcture: | |
#{ | |
# "amount_spent":1000.0, | |
# "product":{ | |
# "category":"bundle", | |
# "machine_name":"foo", | |
# "post_purchase_text":"", | |
# "supports_canonical":false, | |
# "human_name":"foo bar", |
View flash2vlc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FLASH_TMP=`ls /tmp | grep Flash*` | |
if [[ $FLASH_TMP ]]; then | |
vlc /tmp/Flash* | |
else | |
if [[ `ps x | awk '/libgcflashplayer.so\ /{print $1}'` ]]; then | |
flashvids() { lsof -p `ps x | awk '/libgcflashplayer.so\ /{print $1}'` -n 2>/dev/null | perl -lne '@F = split(/ +/, $_, 9); print "/proc/$F[1]/fd/${\($F[3] =~ /(^\d+)/)[0]}" if $F[4] eq "REG" && $F[8] =~ /\(deleted\)$/'; } | |
else |
View scdreader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gpg2 --card-status > /dev/null 2>&1 | |
READERS=($(echo scd getinfo reader_list | gpg-connect-agent –decode | awk '/^D/ {print $2}' | sed 's/%0A/ /g; /^$/d')) | |
BADCHOICE=true | |
while $BADCHOICE | |
do | |
INDEX=0 |
View moonphase.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
moonphase(){ | |
local lp=2551443 | |
local now=$(date -u +"%s") | |
local newmoon=592500 | |
local phase=$((($now - $newmoon) % $lp)) | |
local phase_number=$((((phase / 86400) + 1)*100000)) | |
# Multiply by 100000 so we can do integer comparison. Go Bash! |
View mb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mx=$(($(tput cols)/2));my=$(($(tput lines)-1));s=${1:-1000};cx=${2:--500};cy=${3:-0}; | |
i=${4:-20};co=${5:-8};__="echo -ne ";___="return";:(){ [ $1 -lt $i ] || { | |
$__ "\x1b[m "; $___;};[ $((($4*$4)+($5*$5))) -gt 4000000000 ] && { :p $(($1-3));$___;}; | |
: $(($1+1)) $2 $3 $((((($4*$4)-($5*$5))/10000)+$2)) $(((2*$4*$5)/10000+$3));}; | |
:p(){ c=$1; [ $1 -lt 0 ] && c=0; [ $1 -gt $co ] && c=$(($1%$co+1)); $__ "\x1b[3$(($c))m$c";}; | |
:_(){ [ $1 -lt $my ] || $___;:__ $1 -$mx;:_ $(($1+2));};:__(){ [ $2 -lt $mx ] || { | |
echo;$___;};: 0 $(($cx+$2*$s)) $(($cy+$1*$s)) 0 0;:__ $1 $(($2+1));};:_ -$my; | |
n="\x1b[m";r="\x1b[31m";g="\x1b[33m";echo -ne "${n}usage: mb step shiftx${r}[${g}-2500${r}:${g}1600${r}]$n "; | |
echo -e "shifty${r}[${g}-1500${r}:${g}1500${r}]$n iterations colors${r}[${g}1${r}:${g}8${r}]$n";exit 0 |
View .zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias lastpdf='zathura "`ls -tc ~/Downloads/*.pdf | head -1`"' |
View .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" pipe range as a shellescaped string to the vimclip shell script | |
function Xclip() range | |
echo system('echo '.shellescape(join(getline(a:firstline, a:lastline), '\n')).'| ~/bin/vimclip') | |
endfunction | |
" bind Ctrl-c and Ctrl-Shift-c to copy | |
vmap <C-c> :call Xclip()<CR> | |
vmap <C-C> :call Xclip()<CR> |
View .zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add a helpfull function to search youtube in w3m | |
tube (){ w3m "https://youtube.com/results?search_query=`echo $* | sed 's/[ ]/+/g'`" } |
View bashmagic_luks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/crypttab |\ | |
grep uuid |\ | |
sed -r 's/[\t ]+/ /g' |\ | |
cut -d ' ' -f 2 |\ | |
while read line; do | |
dev=$(ls -la $line); | |
ser=$(smartctl -a $line | grep 'Serial Number'); | |
cryptsetup \ | |
luksHeaderBackup /dev/${dev##*/} \ | |
--header-backup-file \ |