Skip to content

Instantly share code, notes, and snippets.

View xoebus's full-sized avatar
🤖
beep beep

Christopher Brown xoebus

🤖
beep beep
  • San Francisco, CA
View GitHub Profile
@xoebus
xoebus / printers.py
Created November 9, 2009 17:25
A script to check the printers in AT.
#!/usr/bin/env python
import subprocess
good_colour = "\033[0;32m"
bad_colour = "\033[0;31m"
clear_colour = "\033[0m"
class Printer(object):
"""
@xoebus
xoebus / Courses
Created December 22, 2009 21:21
Course Choices
Course Choices
==============
Semester 1
----------
CS/SE Individual Practical 10 Credits
Algorithms and Data Structures 10 Credits
Software Engineering with Objects and Components 10 Credits
Operating Systems 10 Credits
Computer Communications and Networks 10 Credits
@xoebus
xoebus / reccomend.py
Created January 22, 2010 18:21
Diatance between Feature Vectors
# Inf2B
Guardian = (6,4,1,6,6,2,4)
Times = (8,4,4,6,6,6,8)
Telegraph = (10,4,6,6,6,2,9)
Independent = (8,4,3,4,3,3,6)
def dist(vec1, vec2):
vectors = zip(vec1, vec2)
total = 0
@xoebus
xoebus / gist:343792
Created March 25, 2010 16:43
Vertical and Horizontal Swipes for iPhone
UITouch *touch = [touches anyObject];
CGPoint currentPosition = [touch locationInView:[self view]];
CGFloat deltaX = fabsf(gestureStartPoint.x - currentPosition.x);
CGFloat deltaY = fabsf(gestureStartPoint.y - currentPosition.y);
if (deltaX >= kMinimumGestureLength && deltaY <= kMaximumVariance) {
[label setText:@"Horizontal swipe detected"];
[self performSelector:@selector(eraseText) withObject:nil afterDelay:2];
} else if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance) {
@xoebus
xoebus / colours.rb
Created April 4, 2010 22:34
ANSI Colours for Ruby
class String
[:gray, :red, :green, :yellow, :blue, :purple, :cyan, :white].each_with_index do |color, i|
define_method color do "\033[1;#{30+i}m#{self}\033[0m" end
define_method :"#{color}ish" do "\033[0;#{30+i}m#{self}\033[0m" end
end
end
@xoebus
xoebus / cascaders.md
Created April 14, 2010 13:38
Example output for the cascader command.
$ cascader
Searching for cascaders...

There is 1 cascader in this lab:
    Chris Brown     raycroft (Level 5 - West)       Git, Python, Django, 1st Year, 2nd Year

There is 1 other cascader on this floor:

Joe Bloggs jak (Level 5 - North) Maths, Graphics, 1st Year, Ruby

@xoebus
xoebus / Rakefile
Created April 23, 2010 15:00
Rakefile for managing lots of git repositories in one directory.
require "pathname"
GIT_REPOS = Dir["**/.git/.."].map { |path| path = Pathname.new(path).realpath }
desc "Update all repositories"
task :update do
GIT_REPOS.each do |repo|
command "git pull origin master", repo
end
end
@xoebus
xoebus / git
Created April 24, 2010 16:39
Git Cheat Output for a blog post.
git:
Setup
-----
git clone <repo>
clone the repository specified by <repo>; this is similar to "checkout" in
some other version control systems such as Subversion and CVS
Add colors to your ~/.gitconfig file:
@xoebus
xoebus / gist:377773
Created April 24, 2010 17:00
Ack output for a blog post.
[cb@titan:~/Presentations/at-tools-talk on master]
$ ack --text cen
01_title/01_title.md
1:!SLIDE center
02_intro/01_what.md
9:!SLIDE center
15:* cen
03_cen/01_cen.md
Music/iTunes/iTunes Music/Music/
|-- +44
| `-- When Your Heart Stops Beating
|-- 3 Doors Down
| |-- 3 Doors Down
| |-- Away From the Sun
| |-- Seventeen Days
| `-- The Better Life
|-- 30 Seconds To Mars
| |-- 30 Seconds To Mars