Skip to content

Instantly share code, notes, and snippets.

View dom111's full-sized avatar
⌨️

Dom Hastings dom111

⌨️
View GitHub Profile
@dom111
dom111 / ssh_mount.sh
Last active February 17, 2018 01:50
#!/bin/bash
unmount=0;
force=0;
server="";
mount_name=""; # defaults to $server
mount_location="~"; # we'll expand this later
mount_path=""; # remote point point, defaults to ~ usually
mount_opts=",auto_cache,follow_symlinks,transform_symlinks,defer_permissions,noappledouble"; # exclude reconnect unless using keys
binary="sshfs"; # change this if you're using a differently named binary
Q="q=Q.link()[8];alert(`Q=${q+Q+q};eval(Q)`)";eval(Q)
// longer alternative:
console.log(a="console.log(a=%s%s%s,q=a.link()[8],a,q)",q=a.link()[8],a,q)
@dom111
dom111 / quine.sh
Last active February 7, 2018 16:29
A bash quine using a standard quine apporach
Q=\';q='echo "Q=\\$Q;q=$Q$q$Q;eval \$q"';eval $q
@dom111
dom111 / quine.js
Last active August 29, 2017 13:49
s='s=S;console.log(s.replace(/S/,(q=String.fromCharCode(39))+s+q))';console.log(s.replace(/S/,(q=String.fromCharCode(39))+s+q))
// or
s='s=S;q=String.fromCharCode(39);console.log(s.replace(/S/,q+s+q))';q=String.fromCharCode(39);console.log(s.replace(/S/,q+s+q))
osascript -e 'tell application "System Events"
repeat while true
key down {shift}
delay 1
key up {shift}
delay (random number from 12 to 48)
end repeat
end tell' &
curl https://gist.githubusercontent.com/dom111/f18f95dfcdff16eae901f69bb49d2f32/raw/932f9549351141965d16dc390b89eb4845f83982/TODO.sh > ~/TODO.sh;
chmod +x ~/TODO.sh;
if [ ! -e ~/TODO ]; then
echo "First TODO item" > ~/TODO;
echo "Second TODO item" >> ~/TODO;
echo "Third TODO item" >> ~/TODO;
fi
if [ -n $PROMPT_COMMAND ]; then
#!/bin/bash
tput sc;
# ASCII table style:
# perl -nle "\$c=$(tput cols);"'push@F,$_}{$M=$c-($c/4);$L=(sort{$b-$a}map{y///c}@F)[0];$L=($L,$M)[$L>$M];print map{$i=$c-($L+3);$-++;"\x1b[$-;${i}f$_\n"}($s="+"."-"x($L+2)."+"),(map{"|".sprintf(" %-$L.${L}s ",$_)."|"}@F),$s' < ~/TODO;
# coloured
background=44;
foreground=97;
perl -nle "\$c=$(tput cols);\$b=$background;\$f=$foreground;"'push@F,$_}{$M=$c-($c/4);$L=(sort{$b-$a}map{y///c}@F)[0];$L=($L,$M)[$L>$M];print map{$i=$c-($L+5);$-++;"\x1b[$-;${i}f\x1b[$b;${f}m".sprintf(" %-$L.${L}s ",$_)}"",@F,""' < ~/TODO;
tput rc;
$_="....".$"x6;{print"\ec[$_]
";select$a,$a,!s/(.*)(.)/$2$1/,.1;redo}
(function() {
var data = site.panels.getData(),
_randomEmailAddress = function() {
return _randomString(10, _randomCharacter) + '@' + _randomString(10, _randomCharacter) + '.net';
},
_randomString = function(length, generator) {
var s = '';
while (length--) {
s += generator();