Skip to content

Instantly share code, notes, and snippets.

View swalberg's full-sized avatar

Sean Walberg swalberg

View GitHub Profile
@swalberg
swalberg / gist:0f6dc4f58bae6e653082
Created November 10, 2014 19:26
Post to HipChat from browser (default to highlighted text)
// Get your token from the HipChat website "API Access" menu
// Add the token and room where indicated in this line (we use "Easylog")
// Make a new page in your button bar with this in it:
javascript:(function(){function getSelectionText() { var text = "";if (window.getSelection) { text = window.getSelection().toString();} else if (document.selection && document.selection.type != "Control") {text = document.selection.createRange().text;} return text;} var auth_token = "MYTOKENGOESHERE";var room = "Easylog";var ajax = new XMLHttpRequest;var url = "https://api.hipchat.com/v2/room/" + encodeURIComponent(room) + "/notification?auth_token=" + auth_token;ajax.open('POST', url, true);ajax.setRequestHeader("Content-type", "application/json");var message = prompt('log entry?', getSelectionText()); if (message) {ajax.send('{"color":"green", "message": "' + message + '"}');} })()
// getSelectionText() copied from http://stackoverflow.com/questions/5379120/get-the-highlighted-selected-text
action :create do
chef_gem 'f5-icontrol'
if pool_does_not_exist?
converge_by("Create pool #{pool}") do
create_pool
Chef::Log.info("#{new_resource} created pool #{pool}")
end
end
SeanWalbergsMacBookPro:surveys(master *) $ dig +short www.winnipegtransit.com @NS6.SO.CG.SHAWCABLE.NET
SeanWalbergsMacBookPro:surveys(master *) $ dig +short www.winnipegtransit.com @ns56.st.vc.shawcable.net
SeanWalbergsMacBookPro:surveys(master *) $ dig +short www.winnipegtransit.com @NS5.NO.CG.SHAWCABLE.NET
winnipegtransit.com.
198.163.45.39
SeanWalbergsMacBookPro:surveys(master *) $ dig +short www.winnipegtransit.com @cowapdns1.winnipeg.ca
winnipegtransit.com.
198.163.45.39
use_inline_resources if defined?(use_inline_resources)
def whyrun_supported?
true
end
action :create do
package "patch" do
action :upgrade
# This gets you the __git_ps1 function
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
# show some extra metadata in the prompt such as if you have unchecked/tracked files
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Sip>
sip:PHONENUMBER@IPADDRESS
</Sip>
</Dial>
</Response>
@swalberg
swalberg / index.js
Last active August 29, 2015 14:11
Is it `this` or callbacks tripping me up?
asked to geolocate 570 Renfrew St, Winnipeg, MB 0 index.js:12
asked to geolocate 600 Renfrew St, Winnipeg, MB 1 index.js:16
in callback Address {textAddress: "600 Renfrew St, Winnipeg, MB", foo: 1, latlon: null, mapObj: null, geolocate: function}
geocode complete [Object]
placing a marker at 600 Renfrew St, Winnipeg, MB hf {k: 49.8609077, D: -97.19679180000003, toString: function, j: function, equals: function…}
in callback Address {textAddress: "600 Renfrew St, Winnipeg, MB", foo: "seen", latlon: hf, mapObj: Mj, geolocate: function}
geocode complete [Object]
placing a marker at 600 Renfrew St, Winnipeg, MB hf {k: 49.8602556, D: -97.19661889999998, toString: function, j: function, equals: function…}
sean@www:~ $ dig mx hillaryclinton.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.2 <<>> mx hillaryclinton.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52801
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 4, ADDITIONAL: 0
;; QUESTION SECTION:
;hillaryclinton.com. IN MX
datastores = if get_config(:vlan)
hosts_on_network = find_network(get_config(:vlan)).host
hosts_on_network.map
else
dc.datastore
end
package 'Install Apache' do
package_name case node[:platform]
when 'redhat', 'centos'
'httpd'
when 'ubuntu', 'debian'
'apache2'
end
end