Skip to content

Instantly share code, notes, and snippets.

View mkeeter's full-sized avatar

Matt Keeter mkeeter

View GitHub Profile
import wx
class MyFrame(wx.Frame):
""" We simply derive a new class of Frame. """
def __init__(self):
wx.Frame.__init__(self, parent = None, title='Sample', size=(200,100))
self.sb = self.CreateStatusBar(style = wx.NO_BORDER)
self.sb.SetStatusStyles([wx.SB_FLAT])
self.SetBackgroundColour('#000000')
#!/usr/bin/python
import wx
class MyStatusBar(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1)
demo_menu = wx.Menu()
demo_menu.AppendCheckItem(-1,'Test','Status text!')
@mkeeter
mkeeter / gist:2969712
Created June 22, 2012 01:40
TF2 code to png converter
with open('data.txt','r') as f:
lines = f.readlines()
splits = []
for i in range(len(lines)):
# Clean up crufty data
lines[i] = lines[i][:-1].replace('\t',' ')
lines[i] = lines[i].replace('o', '0')
lines[i] = lines[i].replace('X','x')
lines[i] = lines[i].replace('0x',' ')
@mkeeter
mkeeter / Gear F-RAD
Created June 28, 2012 04:10
Javascript function to build involute gear
function gear(x,y){
X = (x - 250) * 0.75/500
Y = (y - 250) * 0.75/500
return (((((X-(0))*(X-(0)) + (Y-(0))*(Y-(0))) <= (0.2665*0.2665))) || (((((X-(0))*(X-(0)) + (Y-(0))*(Y-(0))) <= (0.325*0.325))) && !((((((((((((((Math.atan2(Y, X)<=-3.08509824571||Math.atan2(Y, X)>=3.08509824571)) || (((Math.atan2(Y, X)<=0.0564944078792&&Math.atan2(Y, X)>=-0.0564944078792)) || (((0.286*(Math.atan((-Math.sin(0.0564944078792)*X+Math.cos(0.0564944078792)*Y)/(Math.cos(0.0564944078792)*X+Math.sin(0.0564944078792)*Y)) + Math.acos(0.286/Math.sqrt(X*X + Y*Y))) - Math.sqrt(X*X + Y*Y-0.286*0.286)) < 0) && ((0.286*(Math.atan((-Math.sin(0.0564944078792)*X+Math.cos(0.0564944078792)*(0-Y))/(Math.cos(0.0564944078792)*X+Math.sin(0.0564944078792)*(0-Y))) + Math.acos(0.286/Math.sqrt(X*X + Y*Y))) - Math.sqrt(X*X + Y*Y-0.286*0.286)) < 0)))) || (((Math.atan2(Y, X)<=-2.82329885791&&Math.atan2(Y, X)>=-2.93628767367)) || (((Math.atan2(Y, X)<=0.318293795678&&Math.atan2(Y, X)>=0.20530497992)) || (((0.286*(Math.atan((-Math.sin(0.318293795678)*X+M
@mkeeter
mkeeter / gist:3445255
Created August 24, 2012 03:55
Simple cube with tabs
from cad_shapes import *
# Render boundaries
cad.xmin = -1
cad.xmax = 6
cad.ymin = -1
cad.ymax = 6
cad.mm_per_unit = 25.4 # inch units
r = rectangle(0, 5, 0, 5)
#
# gik.cad
#
# GIK
#
# Neil Gershenfeld
# 8/1/07
#
#
# Sage code to generate NACA airfoil equations
import operator
var('x, y, xc, m, p')
def run(y_chord):
g_chord = vector([1, derivative(y_chord(xc), xc)])
pos_pt = vector([x, y])
pos_chord = vector([xc, y_chord(xc)])
delta = pos_pt - pos_chord
@mkeeter
mkeeter / naca.scm
Last active December 13, 2016 15:00
(use-modules (ice-9 receive))
(use-modules (ao shapes))
(define (naca-thickness t)
"naca-thickness t
Returns the half-thickness for a symmetric airfoil
of chord 1 and thickness t"
(lambda (x)
(* 5 t
(+ (* 0.2969 (sqrt x))
bash 4.3.046-1
bash-completion 2.3-1
binutils 2.25.1-2
bsdcpio 3.2.2-2
bsdtar 3.2.2-2
bzip2 1.0.6-2
ca-certificates 20150426-1
catgets 1.1-2
cmake 3.6.2-1
colordiff 1.0.16-1
import Text.Read (readMaybe)
import Data.Maybe
import Data.Char
import Data.List.Split
import qualified Data.Vector as V
import qualified Data.Map as M
type Reg = Char
data Value = Value Int | Register Reg deriving Show
data Instruction = Send Value