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 / films.txt
Created July 8, 2011 22:52
Film Collection
2001 A Space Odyssey
2012
28 Days Later
28 Weeks Later
300
500 Days of Summer
A Bug's Life
A Clockwork Orange
A Knight's Tale
Aeon Flux
def flash_running?
begin
`ps aux`.split("\n").find { |process| process.include? "Flash" }.match(/\w+\s*\d+\s*([\d.]+)\s*.*/)[1].to_i > 4
rescue NoMethodError
false
end
end
def sample
results = []
@xoebus
xoebus / flash.rb
Created April 11, 2011 12:14
Detect if youtube is playing...
def flash_running?
`ps aux`.split("\n").find { |process| process.include? "Flash" }.match(/\w+\s*\d+\s*([\d.]+)\s*.*/)[1].to_i > 4
end
// Welcome to hell... and the reason
// for the ability to embed variables
// in strings. Yes, this is effectively the
// same as just writing the damn thing out.
// And yes, I did generate this code - I'm not
// that insane.
outputBottleStatement(int numBottles) {
if (numBottles == 99) {
print("99 bottles of beer on the wall, 99 bottles of beer.");
@xoebus
xoebus / grav.rb
Created February 23, 2011 17:46
A Gravatar Downloader
#!/usr/bin/env ruby
require 'digest/md5'
require 'net/http'
class String
def user_hash
Digest::MD5.hexdigest self.downcase
end
end
@xoebus
xoebus / array_compare.c
Created January 20, 2011 21:58
Cryptographic Array Comparisons
// VERY BAD
for (i = 0; i < MAC_LEN; i++)
{
if (MAC_computed[i] != MAC_received[i])
{
return MAC_IS_BAD;
}
}
return MAC_IS_GOOD;
// Run with:
// ./facedetect --cascade="/opt/local/share/opencv/haarcascades/haarcascade_frontalface_default.xml" 0
//
// Remember to change the path of your xml file.
//
// OpenCV Sample Application: facedetect.c
// Include header files
#include "cv.h"
#include "highgui.h"
@xoebus
xoebus / nibble.rb
Last active July 30, 2023 11:18
Some code to grab Minecraft codes off reddit.
require 'nibbler'
require 'open-uri'
CODE_RE = /[A-Za-z1-9]{4}-[A-Za-z1-9]{4}-[A-Za-z1-9]{4}/
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
@xoebus
xoebus / steam.rb
Created December 3, 2010 05:43
Gets playtime of a profile's games.
require 'nibbler'
require 'open-uri'
class SteamProfile < Nibbler
elements 'div.gameListRowItem' => :games do
element 'h4' => :title
element 'h5' => :playtime, :with => lambda { |time|
time.inner_text.strip.split(" ").first.to_f
}
end
@xoebus
xoebus / .gitconfig
Created November 14, 2010 01:10
My git configuration
[user]
name = Chris Brown
email = cb@tardis.ed.ac.uk
signingkey = D5E60FB1
[github]
user = xoebus
token = [REDACTED]
[alias]
st = status
ci = commit