Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
'''
A tidier version of this can be found here https://github.com/rwky/Compare-git-branches
Copyright (c) 2012 Rowan Wookey <admin@rwky.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#!/bin/bash
if [ -z "$SKYPASSWORD" ]
then
echo "Please set the SKYPASSWORD environment variable"
exit 1
fi
if [ -z "$SKYHUBIP" ]
then
SKYHUBIP='192.168.1.1'
@rwky
rwky / gist:e5eabfa4ae1e7713c0503498cdc37dca
Created September 18, 2017 18:10
Sensu elastic-search plugin output
/opt/sensu/embedded/bin/check-es-cluster-health.rb --alert-status YELLOW
/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/elasticsearch-transport-1.0.18/lib/elasticsearch/transport/transport/base.rb:52: warning: constant ::Fixnum is deprecated
/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/elasticsearch-transport-1.0.18/lib/elasticsearch/transport/transport/base.rb:54: warning: constant ::Fixnum is deprecated
ESClusterHealth WARNING: Cluster state is Yellow
opt/sensu/embedded/bin/check-es-cluster-health.rb --alert-status RED
/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/elasticsearch-transport-1.0.18/lib/elasticsearch/transport/transport/base.rb:52: warning: constant ::Fixnum is deprecated
/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/elasticsearch-transport-1.0.18/lib/elasticsearch/transport/transport/base.rb:54: warning: constant ::Fixnum is deprecated
ESClusterHealth OK: Not alerting on yellow

Keybase proof

I hereby claim:

  • I am rwky on github.
  • I am rwky (https://keybase.io/rwky) on keybase.
  • I have a public key whose fingerprint is 06F3 EBC1 6087 66D3 83A7 6819 F7F7 338F 2705 B2CC

To claim this, I am signing this object:

@rwky
rwky / web-log-filter.js
Created April 8, 2012 19:03
A script in node for receiving piped web logs via tail and outputting the number of ips and requests per second
#!/usr/bin/node
/*jslint node: true, sloppy:true */
/**
*Receives input from tail -F /path/to/web/log | node web-log-filter.js
*Then outputs
*Sun Apr 08 2012 19:01:42 GMT+0000 (UTC) time since start 1190 seconds
Requests in the last 5 minutes: 874 (0.97 req/second)
IPs in the last 5 minutes: 331 (0.37 ips/second)
2 requests and 1 IPs purged
*At most every 5 seconds
@rwky
rwky / gist:1961454
Created March 2, 2012 21:13
nginx ppa 1.0.12 boo boo fix
map $scheme $https {
default off;
https on;
}
#add the above to /etc/nginx/nginx.conf in the http section
@rwky
rwky / com.rwky.dont_reopen_windows_at_login.plist
Created October 6, 2011 01:36
Don't reopen windows at login plist file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
Put this file as /Library/LaunchDaemons/com.rwky.dont_reopen_windows_at_login.plist
then run sudo chown root:wheel /Library/LaunchDaemons/com.rwky.dont_reopen_windows_at_login.plist
When you reboot, regardless of if the reopen windows at login is ticket they won't reopen
-->
<dict>
<key>Label</key>
@rwky
rwky / toggle_saved_states.sh
Created October 5, 2011 20:28
Enables/disables application saved states on OSX Lion the right way
#!/bin/bash
#Copyright 2011 Rowan Wookey https://github.com/rwky
#Released under the MIT License http://www.opensource.org/licenses/MIT
#enabled/disables application saved states in osx lion
#most tools with guis seem to lock the "Saved State" folder in
#~/Library/Saved Application State/ however not all apps
#save states there (Preview for example doesn't)
#this script uses the apple preferences to disable it which
#works on any app. To use it simply execute the script in Terminal
#with the path the the application as the first argument