Skip to content

Instantly share code, notes, and snippets.

View abrader's full-sized avatar

Andrew Brader abrader

  • Portland, OR 97209
View GitHub Profile
{
"node":
{
"instance_id": "i-1234abcd",
"state": "busy",
"cpu": "0.00",
"top": "xinteract",
"disk":
{
"/dev/sda1": "60%"
stdClass Object
(
[spotInstanceRequestSet] => stdClass Object
(
[item] => Array
(
[0] => stdClass Object
(
[createTime] => 2010-02-02T21:58:25.000Z
[launchGroup] => BraderTest
#!/usr/bin/env ruby
class ItmatArchive
def self.compress(dir, comp_file)
system("tar -czf #{comp_file} #{dir}")
system("split -b 20m -a 3 #{comp_file} #{dir}.")
system("rm -rf #{comp_file}")
end
@abrader
abrader / wmainfo_fix
Created June 1, 2011 21:51
Brian Goetz fix for Iconv issue in wmainfo-rb
https://rubyforge.org/tracker/index.php?func=detail&aid=27639&group_id=1821&atid=7118
Here's a patch that fixes the error I just reported, where wmainfo barfs on construction if it cannot successfully convert
all the fields using iconv:
-- /usr/lib/ruby/gems/1.8/gems/wmainfo-rb-0.6/lib/wmainfo.rb 2009-12-29 00:50
:02.000000000 -0500
+++ wmainfo.rb 2009-12-29 23:56:19.000000000 -0500
@@ -235,7 +235,12 @@
lengths[key] = read_and_increment_offset(2).unpack("v")[0]
@abrader
abrader / sge_bash_env
Created August 12, 2011 21:02
SGE sge_execd startup on restarted node
/etc/init.d/gpfs/start;
mount isilon.local:/ifs /ifs;
export SGE_CELL=PGFI6448;
export SGE_EXECD_PORT=6449;
export SGE_QMASTER_PORT=6448;
export SGE_ROOT=/ifs/apps/SGE6.2u5;
export SGE_CLUSTER_NAME=PGFI6448;
/ifs/apps/SGE6.2u5/bin/lx24-amd64/sge_execd;
@abrader
abrader / ipmi_config.txt
Created September 12, 2011 14:33
IPMI config for PGFI cluster
# Dell
service ipmi restart
/usr/bin/ipmitool -I open lan set 1 ipsrc static
/usr/bin/ipmitool -I open lan set 1 ipaddr 10.10.125.*
/usr/bin/ipmitool -I open lan set 1 netmask 255.255.0.0
/usr/bin/ipmitool -I open lan set 1 defgw ipaddr 10.10.70.15
/usr/bin/ipmitool -I open lan set 1 access on
/usr/bin/ipmitool -I open lan set 1 snmp PGFI
/usr/bin/ipmitool -I open lan set 1 password 9A5tUpew
/usr/bin/ipmitool -I open user set password 2
@abrader
abrader / brcd_vdx_ptrs.txt
Created October 26, 2011 22:16
Brocade snipets
# Shows what channel-group is set for each interface on the switch under the running config
show running-config interface TenGigabitEthernet 1/0/* channel-group
@abrader
abrader / gist:4157263
Created November 27, 2012 21:39
Cacti CLI commands for adding Watchguard units
Working directory: /var/www/html/cacti/cli
php -q add_device.php --description="AJS73FW1 - Advocare South Jersey Sports & Spine Watchguard" --ip="ajs73fw1-int.chahq.local" --template=22 --community="challcmon"
Response: "Success - new device-id: (450)"
php -q add_tree.php --type=node --node-type=host --tree-id=28 --host-id=450
@abrader
abrader / gist:4196680
Created December 3, 2012 17:46
MySQL to CSV example
SELECT order_id,product_name,qty
FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
@abrader
abrader / forecast_io_test_call
Last active December 20, 2015 06:49
Test API call to Forecast IO for Westminster, MD
{"latitude":39.612931,"longitude":-76.682985,"timezone":"America/New_York","offset":-4,"currently":{"time":1374847403,"summary":"Clear","icon":"clear-day","precipIntensity":0,"precipProbability":0,"temperature":73.44,"dewPoint":59.94,"windSpeed":2.62,"windBearing":351,"cloudCover":0.17,"humidity":0.69,"pressure":1018.94,"visibility":10,"ozone":330.65},"minutely":{"summary":"Clear for the hour.","icon":"clear-day","data":[{"time":1374847380,"precipIntensity":0,"precipProbability":0},{"time":1374847440,"precipIntensity":0,"precipProbability":0},{"time":1374847500,"precipIntensity":0,"precipProbability":0},{"time":1374847560,"precipIntensity":0,"precipProbability":0},{"time":1374847620,"precipIntensity":0,"precipProbability":0},{"time":1374847680,"precipIntensity":0,"precipProbability":0},{"time":1374847740,"precipIntensity":0,"precipProbability":0},{"time":1374847800,"precipIntensity":0,"precipProbability":0},{"time":1374847860,"precipIntensity":0,"precipProbability":0},{"time":1374847920,"precipIntensity":0,"p