Skip to content

Instantly share code, notes, and snippets.

View chrisloy's full-sized avatar
🚀
Coding, obviously.

Chris Loy chrisloy

🚀
Coding, obviously.
View GitHub Profile
@chrisloy
chrisloy / docker-apocalypse
Created December 7, 2016 11:13
Removes all images and temporary files from Docker (Mac)
#!/bin/bash
read -r -p "Are you sure? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
echo "Burning the world...."
docker rm $(docker ps -a -q)
docker rmi -f $(docker images -q)
rm -rf ~/Library/Containers/com.docker.docker/Data/*
;;
@chrisloy
chrisloy / networkless.sh
Last active August 29, 2015 14:17
Use to run task without network access
cmd="sudo unshare -n -- sh -c 'ifconfig lo up; sudo -u $USER $@'"
eval $cmd
def slurp(filename):
return [line.strip() for line in open(filename)]
def green(s):
return '\033[92m' + s + '\033[0m'
def blue(s):
return '\033[94m' + s + '\033[0m'
def red(s):
python -m SimpleHTTPServer 8080
def time[A](block: => A): A = {
val before = System.currentTimeMillis
val result = block
val after = System.currentTimeMillis
println(s"Time: ${after - before}ms")
result
}