Skip to content

Instantly share code, notes, and snippets.

@garborg
garborg / docker.md
Created January 27, 2017 15:25
Utility how-tos

clean up

Cleanup exited processes: docker rm $(docker ps -q -f status=exited) Cleanup dangling volumes: + docker volume rm $(docker volume ls -qf dangling=true) + or repeatedly: docker volume rm $(docker volume ls -qf dangling=true | head -3000) Cleanup dangling images: docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

@garborg
garborg / julia-multi.sh
Created November 2, 2014 01:06
Adapted from Jake Bolewski's julia aliases
#!/bin/sh
$SHELL -c '
echo -e "\e[92mExporting pkg path as:\e[0m"
export JULIA_PKGDIR="/Users/sean/.julia/v0.4/"
echo $JULIA_PKGDIR
echo -e "\e[92mRunning on Julia release\e[0m"
'"julia $@"'
if !isfile("text8")
download("http://mattmahoney.net/dc/text8.zip", "text8.zip")
run(`unzip text8.zip`)
end
if !isfile("lil8")
str = readall("text8")
open("lil8", "w") do io
n = fld(length(str), 20)
write(io, str.data[1:n])
@garborg
garborg / gist:8df890d1603263b77793
Last active August 29, 2015 14:04
Latin1Buffer type for Julia -- converts to UTF-8 on the fly -- quick workaround for importing Latin1-encoded files
module Latin1Buffers
export Latin1Buffer
# safe because 0x00 not a valid continuation byte (leading bits must be '10')
const EMPTY = 0x00
type Latin1Buffer <: IO
io::IO
continuation::Uint8
@garborg
garborg / gist:9324919
Created March 3, 2014 13:28
Column name-cleaning options
1:
(no names) -> x, x_1, x_2...
["" | "_*"]... -> x, x_1, x_2...
["1", "2", ...] -> x1, x2...
["t", "t", ...] -> t, t_1...
["t1", "t1", ...] -> t1, t1_1...
2:
(no names) -> x, x1, x2...
["" | "_*"]... -> x, x1, x2...