This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from lxml import etree | |
doc = etree.parse("http://www.8bitpeoples.com/feed/feed.rss") | |
links = doc.xpath("//link/child::text()") | |
albums = [link[-6:] for link in links if 'discography' in link] | |
print "\n".join(albums) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'open-uri' | |
require 'nokogiri' | |
class Array | |
alias :_old_index_op :[] | |
def [] a | |
if a.is_a?(Regexp) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$link = mysql_connect('localhost', 'root'); | |
function mysql_results($result) { | |
$foos = array(); | |
while ($row = mysql_fetch_row($result)) { | |
$foo = $row[0]; | |
array_push($foos, $foo); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: gemcopy [user@]hostname | |
ruby << LOCAL_RB | sudo sh | |
require 'rubygems' | |
specs = Gem.source_index.search "" | |
local_spec_tuples = specs.map do |spec| | |
[spec.name, spec.version.to_s] | |
end | |
remote_spec_tuples = ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
dep = Gem::Dependency.new '', Gem::Requirement.default | |
specs = Gem.source_index.search dep | |
specs.each do |spec| | |
print "gem install #{spec.name} -v #{spec.version} --no-rdoc --no-ri\n" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl -w | |
sub foo() { | |
$pw = `pwgen -ABn 4 1`; | |
($a, $b, $c, $d) = unpack('cccc', $pw); | |
$dom[0] = pack('cccc', $a, $b, $c, $d) .'.com'; | |
$dom[1] = pack('cccc', $b, $a, $c, $d) .'.com'; | |
$dom[2] = pack('cccc', $a, $c, $b, $d) .'.com'; | |
$dom[3] = pack('cccc', $a, $b, $d, $c) .'.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ec2din | grep $(host $1 | cut -d' ' -f4) | cut -f2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum | |
def split(bits, count) | |
array = [] | |
value = ord | |
mask = (1 << bits) - 1 | |
count.times do | |
array << (value & mask) | |
value = value >> bits | |
end | |
array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int allocate(blocks *b) { | |
int i; | |
i = (b->index + 1) % b->size; | |
while (i != b->index) { | |
if (b->map[i] == 0) { | |
b->map[i] = 1; | |
b->index = i; | |
return i; | |
} | |
i = (i + 1) % b->size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steer = 0; | |
gas = 0; | |
/* Input */ | |
// Xbox 360 Controller | |
steer = steer - SDL_JoystickGetAxis(joystick, 0) / 32768.0; | |
gas = gas + ( SDL_JoystickGetAxis(joystick, 4) / 32768.0 + 1 ) / 2.0; | |
// Keyboard |
OlderNewer