Skip to content

Instantly share code, notes, and snippets.

View jmhobbs's full-sized avatar

John Hobbs jmhobbs

View GitHub Profile
@jmhobbs
jmhobbs / lazer_bot.user.js
Created August 30, 2010 16:51
The original LazerCatz bot!
// ==UserScript==
// @name Lazer Bot
// @author jmhobbs
// @version 2.2
// @namespace http://www.lazercatzthegame.com/
// @description a bot for Lazer Catz
// @include http://www.lazercatzthegame.com/*
// ==/UserScript==
var current_target = null;
@jmhobbs
jmhobbs / node-unstable.rb
Created February 10, 2011 03:09
Homebrew Formula for Node Unstable Branch
require 'formula'
class NodeUnstable <Formula
url 'http://nodejs.org/dist/node-v0.3.8.tar.gz'
head 'git://github.com/ry/node.git'
homepage 'http://nodejs.org/'
md5 '9ed9b4ec2fd726d6e9c94eb3f7b82090'
# Stripping breaks dynamic loading
skip_clean :all
# -*- coding: utf-8 -*-
# Copyright (c) 2010 John Hobbs
#
# http://github.com/jmhobbs/googlecode-irc-bot
#
# 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
# -*- coding: utf-8 -*-
# Copyright (c) 2010 John Hobbs
#
# http://github.com/jmhobbs/googlecode-irc-bot
#
# 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
@jmhobbs
jmhobbs / daemon.py
Created April 13, 2011 05:09
Cooked version of Python daemon base script.
#!/usr/bin/env python
# Origin: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
# Cooked up a bit by @jmhobbs
import sys, os, time, errno, atexit
from signal import SIGTERM
class Daemon:
"""
@jmhobbs
jmhobbs / pptpd.sh
Created May 1, 2011 14:33
Ubuntu 11.04 AWS EC2 PPTPD Installer
#!/bin/bash
#
# This script will install and configure a PPTPD server on your Ubuntu box.
# I use this for a micro instance on Amazon EC2 as a quick, cheap (free!) VPN
#
# This script was tested with Natty Narwahl 11.04, ami-06ad526f
#
# Usage:
# wget https://gist.github.com/raw/950539/pptpd.sh
@jmhobbs
jmhobbs / chunker.py
Created August 31, 2011 18:48 — forked from squarepegsys/chunker.py
Get Python list in chunks
#!/usr/bin/env python
import unittest
from itertools import cycle
## get a list in chunks
## if we run out of items in the list, start again from the beginning
class Chunker(object):
@jmhobbs
jmhobbs / find_files.php
Created September 15, 2011 14:18
Use PHP to recursively enumerate files in a directory.
<?php
/*
Given a path, this function will enumerate the files on that path.
This tree:
test
├── 1.txt
├── a
@jmhobbs
jmhobbs / screen-cam-cap.sh
Created September 28, 2011 17:04
Capture screen and webcam input with ffmpeg
#! /bin/bash
unlink screen.mpg
unlink camera.mpg
echo "Starting Desktop Grab"
ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -sameq screen.mpg > /dev/null 2>&1 &
echo "Starting Camera Grab"
ffmpeg -f video4linux2 -s 640x480 -i /dev/video0 -sameq camera.mpg > /dev/null 2>&1 &
read -p "Press any key to stop recording."
ps aux | grep ffmpeg | awk '{print $2}' | xargs kill
@jmhobbs
jmhobbs / twitter.php
Created October 6, 2011 16:03
Kohana 3 - OAuth & Twitter Example
<?php
class Controller_Twitter extends Controller {
public function action_index () {
// Load a consumer from config file.
$consumer = OAuth_Consumer::factory( Kohana::config( 'oauth.twitter' ) );