Skip to content

Instantly share code, notes, and snippets.

View wxpython statusbar
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')
View gist:2429815
#!/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 Jun 22, 2012
TF2 code to png converter
View gist:2969712
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 Jun 28, 2012
Javascript function to build involute gear
View Gear F-RAD
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 Aug 24, 2012
Simple cube with tabs
View gist:3445255
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)
View gik.cad
#
# gik.cad
#
# GIK
#
# Neil Gershenfeld
# 8/1/07
#
#
View naca.py
# 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
View naca.scm
(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))
View packages
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
View day18.hs
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