Skip to content

Instantly share code, notes, and snippets.

@kogcyc
kogcyc / boiler.pov
Last active November 10, 2017 16:01
a boilerplate POVRay scene, Linux variety
//while inotifywait -e close_write boiler.pov ; do povray boiler.pov -H1050 -W1680 +A0.1 -o- > /home/user/background.png ; done
camera {right 16/9*x look_at <0,-10,0> angle 48 location <1,1,-1>*50 }
light_source {<2,1,-0.5>*5000 color rgb 1}
light_source {<1,1,1>*5000 color rgb 1}
background { rgb <1,1,1>*0 }
@kogcyc
kogcyc / mm2inch.py
Last active November 1, 2017 16:44
convert millimeters to inches and fractional eigths of an inch
# if you want to return something other than 1/8ths an inch
# then change the two 8.0s and the 8 to that sometheing else
# or start using millimeters for goodness' sake
from math import ceil,modf
def mm2inch(millimeters):
a = float(millimeters) / 25.4 # mms -> inches
b = modf(a)[0] # 0 is the
@kogcyc
kogcyc / heroku.sh
Created August 14, 2017 22:45
how to install the heroku cli on raspberry pi
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-arm.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
sudo tar -xvzf heroku-linux-arm.tar.gz -C /usr/local/lib
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
def hexdump(src, length=16, sep='.'):
FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or sep for x in range(256)])
lines = []
for c in xrange(0, len(src), length):
chars = src[c:c+length]
hex = ' '.join(["%02x" % ord(x) for x in chars])
if len(hex) > 24:
hex = "%s %s" % (hex[:24], hex[24:])
printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or sep) for x in chars])
lines.append("%08x: %-*s |%s|\n" % (c, length*3, hex, printable))
@kogcyc
kogcyc / simple_jinja2.py
Created March 13, 2017 00:53
simple jinja2
from jinja2 import Template
t = Template("Hello {{ something }}!")
t.render(something="World")
@kogcyc
kogcyc / heroku_linux_distribution.bash
Last active January 8, 2017 20:39
how to find the distribution on which your Heroku app is running
user@host:~$ heroku run cat /etc/*-release --app app_name
Running cat /etc/lsb-release /etc/os-release on ⬢ app_name... up, run.1971 (Free)
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
@kogcyc
kogcyc / povray_logo.inc
Last active January 3, 2017 00:13
The original Chris Colefax POV-Ray logo
merge {
sphere {2*y, 1 pigment {rgb<0.1,1,0>}}
difference {
cone {2*y, 1, -4*y, 0}
sphere {2*y, 1.4 scale <1,1,2>}
pigment {rgb<1,0.1,0>}
}
difference {
sphere {0, 1 scale <2.6, 2.2, 1>}
sphere {0, 1 scale <2.3, 1.8, 2> translate <-0.35, 0, 0>}
@kogcyc
kogcyc / simple_scene.pov
Created December 21, 2016 14:39
simple POVRAY scene
camera {location <1,1,-1>*50 look_at <0,0,0>}
light_source {<1,1,1>*100 rgb <1,1,1>*1}
#declare count = 4;
#while (count > 0)
sphere {<count*10,0,0> 5 pigment {rgb <1,1,1>*0+(0.3*count)}}
@kogcyc
kogcyc / chainstar.color.study.svg
Created June 12, 2016 18:29
Kogswell chainstar color study
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kogcyc
kogcyc / circ.svg
Created June 12, 2016 14:06
another circle svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.