View wxpython statusbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!') |
View gist:2969712
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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',' ') |
View Gear F-RAD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View gist:3445255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# gik.cad | |
# | |
# GIK | |
# | |
# Neil Gershenfeld | |
# 8/1/07 | |
# | |
# |
View naca.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer