Skip to content

Instantly share code, notes, and snippets.

@powdahound
powdahound / hipchat_bot.js
Created April 25, 2011 18:35
Basic XMPP bot example for HipChat using node.js
// Basic XMPP bot example for HipChat using node.js
// To use:
// 1. Set config variables
// 2. Run `node hipchat_bot.js`
// 3. Send a message like "!weather 94085" in the room with the bot
var request = require('request'); // github.com/mikeal/request
var sys = require('sys');
var util = require('util');
#!/usr/bin/python
import os
def daemonize():
# See http://www.faqs.org/faqs/unix-faq/programmer/faq/ - Section 1.7
print('--- %s: daemonizing' % os.getpid())
if os.fork(): # launch child and...
print('--- %s: kill parent 1' % os.getpid())
os._exit(0) # kill off parent
@powdahound
powdahound / gist:958148
Created May 5, 2011 22:54
HipChat API message with HTML
<?php
// HipChat PHP library: https://github.com/hipchat/hipchat-php
include 'HipChat.php';
$token = "<your token>";
$room = "Development";
$message = 'Some <b>html</b>, &lt;entities&gt;, and a <a href="https://www.hipchat.com">link</a>.<br />We can even use line breaks!';
$hc = new HipChat($token);

Keybase proof

I hereby claim:

  • I am powdahound on github.
  • I am garret (https://keybase.io/garret) on keybase.
  • I have a public key ASCxh69DoZg4wmKJw4vTpdG7avcneGhUfESiFmc_7qpezAo

To claim this, I am signing this object:

@powdahound
powdahound / gist:5250837
Created March 27, 2013 01:30
Script powering Twisted mirror on github.com/powdahound/twisted
#!/bin/sh
cd /srv/misc/twisted_github_fork/repo
git svn rebase
git push origin master
@powdahound
powdahound / install_air.sh
Created January 21, 2013 15:55
Installing Adobe AIR on Ubuntu.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get install lib32asound2 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32z1 libc6 libc6-i386 ia32-libs-gtk lib32nss-mdns
curl http://usablesoftware.files.wordpress.com/2011/02/getlibs-all-deb.pdf > getlibs-all.deb
<?php
$image_urls = array(
'http://b.thumbs.redditmedia.com/crFh5ZpigMuuO68U.png',
'http://i.imgur.com/Boqat.png',
'http://i.imgur.com/gwfE3.png',
'http://i.imgur.com/WRBMg.png',
'http://i.imgur.com/C1fqv.png',
'http://i.imgur.com/Ycc5g.png',
'http://i.imgur.com/wsow1.png'
dev:~ redis-cli
redis 127.0.0.1:6379> get foo
(nil)
redis 127.0.0.1:6379> set foo bar
OK
redis 127.0.0.1:6379> get foo
"bar"
redis 127.0.0.1:6379> expire foo 5
(integer) 1
redis 127.0.0.1:6379> ttl foo
@powdahound
powdahound / default.rb
Created September 13, 2011 17:11
hosts cookbook
# Find all other nodes
nodes = {}
search(:node, "chef_environment:#{node.chef_environment}") do |n|
# skip current node
if n[:fqdn] and n[:fqdn] != node[:fqdn]
nodes[n[:fqdn]] = n
end
end
Chef::Log.info "Other hosts: #{nodes.keys.sort.join(', ')}"
2011-09-06T00:33:34.743416+00:00
2011-09-06T00:54:22.163846+00:00
2011-09-06T01:33:37.769745+00:00
2011-09-06T01:54:29.956684+00:00
2011-09-06T02:33:39.601303+00:00
2011-09-06T02:54:31.254695+00:00
2011-09-06T03:33:42.972409+00:00
2011-09-06T03:54:34.945778+00:00
2011-09-06T04:33:44.081260+00:00
2011-09-06T04:54:36.898843+00:00