Skip to content

Instantly share code, notes, and snippets.

@thenoviceoof
thenoviceoof / kbm.py
Last active January 4, 2016 14:59
Keyboard Mouse
# - A first approximation of using the keyboard as a trackpad
# - It uses curses/Xlib for input and mouse interaction, so if you don't
# have those you're going to have a bad time
# - This is only a proof of concept, sniffing X for keystrokes and
# finding out how to seamlessly pop in and out of
# keyboard-as-trackpad-mode is left as an exercise to the reader
# - It turns out this isn't a very good control scheme, given the
# limited vertical resolution (4-6 rows vs. ~12 columns), and that
# it additionally suffers from all the problems inherent in
# acceleration based control schemes
@thenoviceoof
thenoviceoof / phylactery.go
Created June 25, 2013 10:51
This is a small exercise, for making a program that will keep un-cooperative processes running when the processes are just lazy
/*
* phylactery.go
*******************************************************************************
* This is a small exercise, for making a program that will keep
* un-cooperative processes running when the processes are just lazy
*
* Do what you want with this code
*/
package main
@thenoviceoof
thenoviceoof / firefly.ly
Created May 1, 2013 04:14
Because sometimes your other musically inclined roommates notice you can provide ambient strings
\version "2.14.1"
\header {
title = "Firefly Theme"
}
<<
\new ChordNames {
\chordmode {
s2
@thenoviceoof
thenoviceoof / imperial_march.py
Last active September 28, 2020 12:19
Play the Imperial March with an IRobot Create, cloak and stormtroopers not required
import serial
import time
# this is the port you're connecting to the irobot with
# on windows, this is something like COM2
N = 2
def ints2str(lst):
'''
Taking a list of notes/lengths, convert it to a string
@thenoviceoof
thenoviceoof / pycc.py
Last active December 14, 2015 06:49
Oh god this is such a terrible idea
import timeit
# introducing a C primitive to the Python namespace for fun and profit
# if you're familiar with the way Python-C modules are usually built,
# you'll notice this is abstracting way a bunch of things,
# which may or may not be possible
# syntax: C <ret_type> <name>(...<params>...) with {<header>: <library>}
C str fn_name(int something) with {'stdio.h': 'stdlib', 'math.h': 'm'}:
// blah blah blah
@thenoviceoof
thenoviceoof / trivial.bash
Created January 23, 2013 15:53
Infinite github cheat
#!/bin/bash
# execute from cron for github cheese!
# assume starting from ~/
cd git/trivial
git rm *
r=`date | md5sum`
touch $r
git add .
git commit -m "$r"
# assumes you have master/origin configured
@thenoviceoof
thenoviceoof / cells.py
Created October 9, 2012 14:48
Randomly generate automata
#!/usr/bin/env python
import os
import time
import random
rows, columns = os.popen('stty size', 'r').read().split()
columns = int(columns)
middle = columns/2
@thenoviceoof
thenoviceoof / svn_log_username.sh
Created September 13, 2012 22:58
get usernames from svn log
svn log | grep "^r[[:digit:]]\{4\}" | cut -f 3 -d " " | sort | uniq
@thenoviceoof
thenoviceoof / genpass.py
Created August 30, 2012 21:58
Utility to generate passwords
#!/usr/bin/python
import time
import base64
import hashlib
hash_out = base64.urlsafe_b64encode(hashlib.md5(str(time.time())).digest())
print hash_out[:-2].replace('-', ',').replace('_', '.')
@thenoviceoof
thenoviceoof / watchdog.sh
Created July 22, 2012 16:26
watchdog for selfspy
#!/bin/sh
if [ -z "$(pgrep -fl selfspy)" ]
then
DISPLAY=:0.0 notify-send -u critical "Selfspy isn't running";
fi