Skip to content

Instantly share code, notes, and snippets.

View pstengel's full-sized avatar

Paul Stengel pstengel

View GitHub Profile
@pstengel
pstengel / megastats.rb
Created April 19, 2011 18:51
Get Mega Millions stats, parse them, and show lagging and trending numbers
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'pp'
doc = Nokogiri::HTML(open "http://megamillions.com/numbers/pastdrawings.asp")
standard = Hash.new
@pstengel
pstengel / add-iprange.rb
Created April 19, 2011 13:20
Adds an IP range to an OnApp VM
#!/usr/bin/env ruby
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2=true
require 'rubygems'
require 'mechanize'
require 'pp'
if ARGV[0].to_i == 0 || ARGV[1].to_i == 0
puts "Usage: add-iprange.rb <VM ID> <number of IPs>"
exit 1
@pstengel
pstengel / numbers.php
Created April 4, 2011 14:30
Mazzi's test.
<?php
for ($i = 1; $i <= 100; $i++) {
if (($i % 3) == 0 && ($i % 5) == 0) {
print "FizzBuzz\n";
} elseif (($i % 3) == 0) {
print "Fizz\n";
} elseif (($i % 5) == 0) {
print "Buzz\n";
} else {
@pstengel
pstengel / default.html
Created March 28, 2011 22:01
layout for my site
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>{{ page.title }}</title>
<link rel="stylesheet" href="css/reset.css" type="text/css" />
<link rel="stylesheet" href="css/text.css" type="text/css" />
<link rel="stylesheet" href="css/960.css" type="text/css" />
<link rel="stylesheet" href="css/site.css" type="text/css" />
</head>
echo -ne "GET /<SOME_CHARACTERS_HERE> HTTP/1.0\n\n" | ncat tr.im 80 | grep "Location:"
javascript:var x=document.getElementsByTagName("a");for(i=0;i<x.length;i++){if(x[i].innerHTML.match(/.*\.gz$/)){var f=document.createElement("iframe");f.setAttribute("src",x[i].href);f.style.width="0px";f.style.height="0px";document.body.appendChild(f);}}
<?php
declare(ticks = 1);
class HRServerMon_Poller
{
var $hostname;
function HRServerMon_Poller($hostname)
{