Skip to content

Instantly share code, notes, and snippets.

@gak
gak / gist:8537275
Created January 21, 2014 09:51
dude
void main(void)
{
float x,y;
float ratio = iResolution.y / iResolution.x;
x = gl_FragCoord.x / iResolution.x - 0.5;
y = gl_FragCoord.y / iResolution.y * ratio - 0.25;
float PI = 3.14159265358979323846264;
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e53a722096f0 aafd21071b99 /opt/bin/run_all 41 minutes ago Up 28 minutes 127.0.0.1:49251->22/tcp, 127.0.0.1:49252->9200/tcp es-b
0208431f9c7b aafd21071b99 /opt/bin/run_all 41 minutes ago Up 28 minutes 127.0.0.1:49249->22/tcp, 127.0.0.1:49250->9200/tcp es-a
@gak
gak / git_branch.sh
Last active December 23, 2015 07:29
function git_branch
set -g git_branch (git rev-parse --abbrev-ref HEAD ^ /dev/null)
if [ $status -ne 0 ]
set -ge git_branch
set -g git_dirty_count 0
else
set -g git_dirty_count (git status --porcelain | wc -l | sed "s/ //g")
end
end
@gak
gak / vector2d.py
Created July 31, 2013 08:58
I wrote this Python vector class a while ago for this blog post: http://slowchop.com/2006/07/15/a-fast-python-vector-class/
from random import randint, random
import math
class Pos(object):
__slots__ = ('x', 'y')
def __init__(self, x=0.0, y=0.0):
self.x = x
self.y = y
def __str__(self):
return '(%.1f,%.1f)' % (self.x, self.y)
@gak
gak / fish-prompt.sh
Last active February 4, 2022 18:34
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
function _common_section
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c2
printf $argv[2]
printf $argv[3]
printf $c0
printf ", "
@gak
gak / fish-disk-free.sh
Created June 10, 2013 06:43
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
# Show disk usage when low
set -l du (df / | tail -n1 | sed "s/ */ /g" | cut -d' ' -f 5 | cut -d'%' -f1)
if test $du -gt 80
error du $du%%
end
@gak
gak / fish-load-average.sh
Last active December 18, 2015 07:29
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
# Show loadavg when too high
set -l load1m (uptime | grep -o '[0-9]\+\.[0-9]\+' | head -n1)
set -l load1m_test (math $load1m \* 100 / 1)
if test $load1m_test -gt 100
error load $load1m
end
@gak
gak / fish-python-virtualenv.sh
Last active December 18, 2015 07:29
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
# Virtualenv
if set -q VIRTUAL_ENV
section env (basename "$VIRTUAL_ENV")
end
# Git branch and dirty files
git_branch
if set -q git_branch
set out $git_branch
if test $git_dirty_count -gt 0
set out "$out$c0:$ce$git_dirty_count"
end
section git $out
end