Skip to content

Instantly share code, notes, and snippets.

View raws's full-sized avatar
🥯
dabbling in pumpernickel

Ross Paffett raws

🥯
dabbling in pumpernickel
View GitHub Profile
19:34 ~ $ rvm list
rvm Rubies
ruby-1.8.7-p249 [ x86_64 ]
=> ruby-1.9.2-preview1 [ x86_64 ]
System Ruby
system [ x86_64 i386 ppc ]
def dangerous!
socket = UDPSocket.new
socket.connect host, port
socket.send …
ensure
socket.close
end
23:22 arma (master)$ ./test/test.rb
Querying 15 servers...
[HGs]Chernarus Life(c)Heeresgruppe Sued (24 / 42 players)
|- status = :playing
|- mission.name = C.L.Revolution 2.1.2b HGs?
|- mission.map = Chernarus
|- mission.difficulty = veteran
|- mission.game_type = Team
|- mission.teams = 0
7/9/10 6:20:11 PM [0x0-0x5cf5cf].com.valvesoftware.steam[51043] Game update: AppID 1250 "Killing Floor", ProcID 51481, IP 0.0.0.0:0
7/9/10 6:20:11 PM /Users/ross/Library/Application Support/Steam/SteamApps/common/killingfloor/Killing Floor.app/Contents/MacOS/Killing Floor[51481] CPSGetCurrentProcess(): This call is deprecated and should not be called anymore.
7/9/10 6:20:11 PM /Users/ross/Library/Application Support/Steam/SteamApps/common/killingfloor/Killing Floor.app/Contents/MacOS/Killing Floor[51481] CPSSetForegroundOperationState(): This call is deprecated and should not be called anymore.
7/9/10 6:20:16 PM steam[51049] kCGErrorIllegalArgument: CGSShapeWindow
7/9/10 6:20:16 PM [0x0-0x5cf5cf].com.valvesoftware.steam[51043] Fri Jul 9 18:20:16 Stig.local steam[51049] <Error>: kCGErrorIllegalArgument: CGSShapeWindow
7/9/10 6:20:16 PM [0x0-0x5cf5cf].com.valvesoftware.steam[51043] inputosx.cpp (1730) : Assertion Failed: !"CInputOSX::GetEnglishIMEHandle impl"
7/9/10 6:20:16 PM [0x0-0x5cf5cf].com.valvesoftware.
doc = Hpricot(open("http://www.teomyr.eu/wowhead/irc-quotes?start=#{offset}"))
doc.search("div.quote").each do |quote|
date = Time.parse((quote/"div.quote-header").inner_text[/\d{4}\-\d{2}\-\d{2}\s+\d{2}:\d{2}/])
body = (quote/"p.quote").inner_text.gsub(/^(?:[\[\]\d:]+)\s*(.*)$/, '\1').gsub(/<[@\+]/, "<")
quotes << {
:date => date,
:body => body
}
end
@raws
raws / getTrueName.c
Created August 2, 2010 01:56
Bit of C to resolve the original path of an OS X alias
// getTrueName.c
//
// DESCRIPTION
// Resolve HFS and HFS+ aliased files (and soft links), and return the
// name of the "Original" or actual file. Directories have a "/"
// appended. The error number returned is 255 on error, 0 if the file
// was an alias, or 1 if the argument given was not an alias
//
// BUILD INSTRUCTIONS
// gcc-3.3 -o getTrueName -framework Carbon getTrueName.c
i, n = 0, 5
until i > n
puts "#{" " * i}8#{" " * (n - i)}:-)"
i += 1
sleep 1
end
puts " DEAL 8-) WITH IT"
@raws
raws / workon.rb
Created September 26, 2010 06:11
Over-engineered bit of Ruby to try out some code techniques and help me work on projects
#!/usr/bin/env ruby
require "pathname"
require "rubygems"
require "active_support/inflector"
require "spotlight"
class Symbol
Operators = {
class AcfDistributionListParser < RightAWSParser # :nodoc:
def reset
@result = { :distributions => [] }
end
def tagstart(name, attributes)
case full_tag_name
when %r{/Signer$}
@active_signer = {}
when %r{(Streaming)?DistributionSummary$},
%r{^(Streaming)?Distribution$},
def distribution_config_to_xml(config, xml_wrapper='DistributionConfig') # :nodoc:=
cnames = ''
logging = ''
origin_access_identity = ''
trusted_signers = ''
# CNAMES
unless config[:cnames].blank?
Array(config[:cnames]).each { |cname| cnames += " <CNAME>#{cname}</CNAME>\n" }
end
# Logging