Skip to content

Instantly share code, notes, and snippets.

View timtrueman's full-sized avatar

Tim Trueman timtrueman

View GitHub Profile
@timtrueman
timtrueman / ksp-checklist.md
Last active January 10, 2018 22:19
KSP checklist

Vehicle assembly

  1. Install MapSat GPS radio
  2. Verify sufficient power for electric rover (solar panel or RTG that doesn't fall off in dynamic environments)
  3. Does gear touch the ground when extended?
  4. Did you pack enough delta-v? (No.)
  5. Are you planning on returning?
  6. Is your shit manned or did that little probe body ruin the day?
  7. How many crew do you want?
  8. Did you remember ASAS and SAS?
  9. Is RCS needed?
@timtrueman
timtrueman / LICENSE
Created January 1, 2012 18:25
Facebook-style superfast, preloading photo viewer
Copyright (c) 2011 Tim Trueman @timtrueman
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@timtrueman
timtrueman / amnesia.sh
Created August 27, 2011 11:38
Give Lion Amnesia
defaults write com.apple.Preview NSRecentDocumentsLimit 0
defaults delete com.apple.Preview.LSSharedFileList RecentDocuments
defaults write com.apple.Preview.LSSharedFileList RecentDocuments -dict-add MaxAmount 0
def sendThrottle(self, throttle):
data_selection_packet = "DATA0\x19\x00\x00\x00" # throttle
data = pack('ffffffff', throttle, throttle, throttle, throttle, throttle, throttle, throttle, throttle)
data_selection_packet += data
self.sock.sendto(data_selection_packet,(safe_get_ip_address(),49000))
def sendJoystick(self, joystick, rudder):
data_selection_packet = "DATA0\x08\x00\x00\x00" # joystick
data = pack('ffffffff', joystick[1], joystick[0], rudder, 0, 0, 0, 0, 0)
data_selection_packet += data
@timtrueman
timtrueman / rainbow.js
Created July 19, 2011 02:06
Rainbowify text in HTML
// I'm a JavaScript noob, take it easy on me...
// mathematical color rotation function thingies
function decrease(degree) { return (60 - degree % 60) * 4.25; }
function increase(degree) { return (degree % 60) * 4.25; }
function zero(degree) { return 0; }
function maximum(degree) { return 255; }
// We would use better templating/rendering but I'm totally lazy and this is a hacky prototype demo script
function render_span(r, g, b, character) { return '<span style="color: rgb(' + Math.round(r) + ', ' + Math.round(g) + ', ' + Math.round(b) + ');">' + character + '</span>'; }
$(document).ready(function() {
$(':text,:password').live('focus',function(event) {
if (typeof event.target.original_value == "undefined") {
event.target.original_value = event.target.value;
}
if (event.target.value == event.target.original_value) {
event.target.value = '';
}
$(event.target).css('color','#000')
});
@timtrueman
timtrueman / django_cached_count_proxy.py
Created November 18, 2010 00:15
Django cached .count() proxy for querysets that is generic and works with pagination in object_list (which clones and overrides any monkeypatched count method so you have to override the clone method first).
class CachedCountCloneProxy(object):
''' This allows us to monkey-patch count() on QuerySets so we can cache it and speed things up.
._clone is called so we have to monkey-patch that first...
'''
def __init__(self, queryset):
self._queryset = queryset
self._queryset._clone_original = self._queryset._clone
def __call__(self):
#!/usr/bin/python
#encoding:utf-8
from telnetlib import Telnet
import time
import sys
"""
Usage
#!/usr/bin/python
#encoding:utf-8
import stompy
import time
import curses
def monitor_stompserver():
try:
myscreen = curses.initscr()
#!/usr/bin/env python
# encoding: utf-8
import serial
import sys
#set up the serial port for action
#originally from http://dmt195.wordpress.com/2009/01/19/python-to-interface-with-the-pololu-8-channel-servo-controller/
ser=serial.Serial(port='/dev/tty.Pololu', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1)