Skip to content

Instantly share code, notes, and snippets.

@kogcyc
kogcyc / intersection.txt
Last active October 15, 2019 17:40
intersection two 2 cylinders - formula
Here is the formula for calculating the intersection points of 2 cylinders where the centerlines of the cylinders intersect.
Definitions:
Brad = Branch Radius
Mrad = Main Radius
TX = the X coord of the intersection
TY = the Y coord of the intersection
TZ = the Z coord of the intersection
@kogcyc
kogcyc / heroku_termux_heroku.txt
Created April 26, 2019 15:03
TERMUX HEROKU
wget http://cli-assets.heroku.com/heroku-cli/channels/stable/heroku-cli-linux-x64.tar.gz -O heroku.tar.gz
tar -xvzf heroku.tar.gz
mv blahblahblah heroku
mv heroku /data/data/com.termux/files/usr/lib/heroku
ln -s /data/data/com.termux/files/usr/lib/heroku/bin/heroku /data/data/com.termux/files/usr/bin/heroku
@kogcyc
kogcyc / povray.lang
Created April 25, 2019 13:46
/usr/share/gtksourceview-3.0 SYNTAX POVRAY GEDIT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language _name="POV-Ray 3.7" version="1.0" _section="Others" mimetypes="text/x-povray">
<escape-char>\</escape-char>
<string _name="String" style="String" end-at-line-end="FALSE">
<start-regex>"</start-regex>
<end-regex>"</end-regex>
</string>
@kogcyc
kogcyc / shimano9spline280.svg
Last active March 15, 2019 22:05
that which is generated by shimano9spline280.py
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kogcyc
kogcyc / shimano9spline280.py
Last active March 15, 2019 16:08
a Python bit that creates the shape of the spline for a 'standard' Shimano freehub cassette body
from math import cos,sin,atan,radians
import os
class Pt():
def __init__(self,x=0,y=0):
self.x = x
self.y = y
def rotate(self,about,a,returnInts=False):
ax = about.x
@kogcyc
kogcyc / prism2lathe.py
Created February 6, 2019 22:12
change a PovRAY 'prism' object, which was generated by Inkscape, into a 'lathe' object ( povray prism lathe )
import sys
fo = open(sys.argv[1] + '.pov')
a = fo.read()
fo.close()
b = a.find('prism')
c = a[b:]
d = c.find('}')
e = c[:d+1]
f = e.replace('prism','#declare ' + sys.argv[1] + ' = ' + 'lathe')
g = f.replace(' linear_sweep\n','')
@kogcyc
kogcyc / watch_show_image.py
Last active January 28, 2019 19:39
use Python to display a bitmap when it is modifed (saved)
import os
import time
from PIL import Image
import psutil
filename = './rectangle.png'
modifiedTime = os.stat(filename).st_mtime
while True:
time.sleep(0.1)
checkTime = os.stat(filename).st_mtime
@kogcyc
kogcyc / vapory.py
Created January 7, 2019 20:06
example of using vapory to run Povray
# vapory depends on numpy
from vapory import *
camera = Camera( 'location', [30,30,-30], 'look_at', [0,0,0] )
light1 = LightSource( [100,100,-200], 'color', [1,1,1] )
light2 = LightSource( [-100,-100,200], 'color', [1,1,1] )
bg = Background('color',[1,1,1])
ll = []
@kogcyc
kogcyc / addBorder.sh
Created November 24, 2017 00:11
resize a set of animation frame, via Imagemagick, by adding a black border
convert *.png -background black -gravity center -extent 1280x720 -set filename:f '%t' '%[filename:f].jpg'
@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 }