Skip to content

Instantly share code, notes, and snippets.

View crmccreary's full-sized avatar

Charles McCreary P.E. crmccreary

View GitHub Profile
@crmccreary
crmccreary / .gitignore
Created November 14, 2012 02:44
Traverse a linked list
*.obj
*.sym
@crmccreary
crmccreary / simple_sort.asm
Created October 31, 2012 01:10
Simple sort with min, max, and range
;MOLLY MCCREARY
;mm57298
;Programming Assignment 2
;The program should sort a 15 number array from smallest to largest
;Then, report the range and median
.ORIG x3000
LEA R0, Arr ;Load address of Arr into r0
LD R1, N ;load N==15 into r1, the length of Arr
OUTER BRz DONE ;if r1=0, then go to DONE
@crmccreary
crmccreary / rotate_left.asm
Created October 22, 2012 19:36
rotate left in a simple assembly language
.ORIG x3000
; load the number to be rotated left into R0
LDI R0, NUM
; load how many times to rotate left into R1
LDI R1, TIMES
; If R1 == 0, done
BRz DONE
LOOP:
; Copy R0 to R2 (Shouldn't there be an easier way to load R0 into R2?)
ADD R2, R0, #0
@crmccreary
crmccreary / recursive_copy.py
Created October 4, 2012 03:48
Recursively copy files from src to dst not already in dst
import os
import shutil
import sys
import argparse
def split_path(path):
folders=[]
while 1:
path,folder=os.path.split(path)
@crmccreary
crmccreary / gist:3766542
Created September 22, 2012 15:35
Bash one liner to rename multiple files
for file in SCF_Leg_17450_Lower_* ; do mv "${file}" "${file/SCF_Leg_17450_Lower/SCF_Leg_17282}" ; done
@crmccreary
crmccreary / scanwin32.py
Created August 27, 2012 20:06
scanwin32
import ctypes
import re
def ValidHandle(value):
if value == 0:
raise ctypes.WinError()
return value
NULL = 0
HDEVINFO = ctypes.c_int
@crmccreary
crmccreary / s3put
Created June 14, 2012 14:00 — forked from mattbillenstein/s3put
boto parallel s3 upload script
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import boto
import config
import gevent
import gevent.pool
import os
@crmccreary
crmccreary / upgrade_notes.rst
Created February 25, 2012 18:02
Upgrading OpenERP pre 6.1.1 to 6.1.1
@crmccreary
crmccreary / recursive_copy.py
Created January 11, 2012 14:57
Recursive copy files in src but not in dst
import os
import shutil
import sys
import argparse
def split_path(path):
folders=[]
while 1:
path,folder=os.path.split(path)
@crmccreary
crmccreary / euler_angles_from_rotation_matrix.py
Created January 11, 2012 04:50
Computing Euler angles from a rotation matrix
import numpy as NP
import math
def isclose(x, y, rtol=1.e-5, atol=1.e-8):
return abs(x-y) <= atol + rtol * abs(y)
def euler_angles_from_rotation_matrix(R):
'''
From a paper by Gregory G. Slabaugh (undated),
"Computing Euler angles from a rotation matrix