Skip to content

Instantly share code, notes, and snippets.

View freespace's full-sized avatar

Steve Bian freespace

View GitHub Profile
# -*- coding: utf-8 -*-
"""
Created on Sat May 31 11:35:04 2014
@author: freespace
"""
def repayment_pc(earning):
thresholds = [ [59421, 0.04],
[65497, 0.045],
#include <stdio.h>
int main(void) {
float f = 16777210;
int cnt;
for (cnt =0; cnt < 15; ++cnt) {
printf("cnt=%d\tf=%f\n", cnt, f+cnt);
}
return 0;
}
// START_DEFINITION
/**
* Fingerprint Tor authoritative directories enacting the directory protocol.
*/
fingerprint('anonymizer/tor/node/authority') = $tor_authority
and ($tor_directory or preappid(/anonymizer\/tor\/directory/));
// END_DEFINITION
// START_DEFINITION
/*
@freespace
freespace / gen_sessions.py
Created October 9, 2014 12:09
Generates 15 minute sessions times when given an interval in time.
def sessions(starth, startmin, endh, endmin):
"""
starth: start hour, 24 hr
startm: start minute
endh: end hour, 24 hr
endmin: end minute
"""
curh = starth
curmin = startmin
while curh < endh or curmin< endmin:
@freespace
freespace / scroll.sh
Created September 12, 2011 05:07
macross proof version
#!/bin/bash
if [ $# -ne 1 ]; then
echo "you are doing it wrong"
echo "Usage: $0 <file>"
exit 1;
fi
IFS="
"
@freespace
freespace / scrape.sh
Created September 14, 2011 04:47
Downloads webcam images periodically
#!/bin/bash
if [ $# -ne 2 ];
then
echo "Usage: $0 <url> <refresh period>"
exit 1;
fi
URL="$1"
From 207ed833c4de43fa29dcbd97a3d1a7494bd9d3cc Mon Sep 17 00:00:00 2001
From: Shu Ning Bian <freespace@gmail.com>
Date: Wed, 18 Jul 2012 00:57:48 +1000
Subject: [PATCH] Restores stub drain function to avrisp2
---
avrdude/usb_libusb.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/avrdude/usb_libusb.c b/avrdude/usb_libusb.c
@freespace
freespace / gist:1322095
Created October 28, 2011 11:30
Apple script to lock screen using keychain's menu item
(*
Probe Menu Bar
This script uses UI element scripting to return a list of every menuitem
of every menu for every application currently running.
If "Enable access for assistive devices" is not checked,
this script will open the Universal Access System Preference and ask
the user to check the checkbox.
c0 0e 60 80 00 00 9f ff
ff ff e0 20 20 20 20 20
20 20 20 20 20 20 20 20
20 20 3f ff ff ff ff ff
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff
@freespace
freespace / gist:2585921
Created May 3, 2012 14:14
Backup of some arduino code to handle OV7670
#define SIO_C 2
#define SIO_D 4
#define SIO_CLOCK_DELAY 100
void setup()
{
pinMode(8,OUTPUT);
// while(1)
// {