Skip to content

Instantly share code, notes, and snippets.

View pstengel's full-sized avatar

Paul Stengel pstengel

View GitHub Profile
<?php
declare(ticks = 1);
class HRServerMon_Poller
{
var $hostname;
function HRServerMon_Poller($hostname)
{
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);}}
echo -ne "GET /<SOME_CHARACTERS_HERE> HTTP/1.0\n\n" | ncat tr.im 80 | grep "Location:"
@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>
@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 / 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 / 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
class BFG9000Logger
def logger(options = nil)
@logger ||= Logger.new options
end
end
@pstengel
pstengel / longif.rb
Created January 4, 2012 15:30
Format this nicely plz
if (args[:reseller_filter].empty? && args[:user_filter].empty?) || (args[:reseller_filter].include?(u['owner']) || args[:user_filter].include?(u['user']))
@pstengel
pstengel / yaml2csv.rb
Created January 24, 2012 16:55
Convert a YAML input via STDIN to CSV, stripping property names
#!/usr/bin/env ruby
require 'yaml'
require 'csv'
YAML.load(STDIN).each do |y|
puts y.values.to_csv
end