I hereby claim:
- I am johnl on github.
- I am johnl (https://keybase.io/johnl) on keybase.
- I have a public key whose fingerprint is 4B19 9EC6 F538 7248 5B97 3C7A CCFF 06B7 5C06 D153
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # Usage example | |
| require "inspect_env" | |
| use InspectEnv | |
| run GenericSinatraApp |
| #!/bin/bash | |
| # Script to send an SMS alert via Twilio. | |
| # handy for nagios. | |
| # supports proper Twilio API keys, so you don't have to share your user token | |
| # https://www.twilio.com/docs/api/rest/request | |
| function printHelpAndExit { | |
| echo "usage: ./`basename $0` -a \"twilio account sid\" -u \"twilio api key sid\" -p \"twilio api key secret\" -s \"sender number\" -d \"destination number\" -m \"message\"]" | |
| echo "optionally add -l to enable logging to syslog using the logger command" | |
| echo "example: ./`basename $0` -a \"ACxxxxxxxxxxxxxxxxxxxx\" -u \"SKxxxxxxxxxxxxxxxx\" -p \"xxxxxxxxxxxxxxxx\" -s \"+4401274000000\" -d \"+4401130000000\" -m \"HTTP Timed out after 10 seconds\"" |
| class Unicorn::HttpServer | |
| alias process_client_orig process_client | |
| undef_method :process_client | |
| def process_client(client) | |
| process_client_orig(client) | |
| rss = `ps -o rss= -p #{Process.pid}`.chomp.to_i / 1024 | |
| puts "Unicorn #{Process.pid}, #{request.env['REQUEST_METHOD']} #{request.env['REQUEST_PATH']} using #{rss}M" | |
| end | |
| end |
| #!/usr/bin/ruby | |
| # Parses linux scsi command logs | |
| # http://www.seagate.com/staticfiles/support/disc/manuals/scsi/100293068a.pdf | |
| # give this program itself as input to test | |
| # DE AD BE EF == 3735928559 | |
| # CA FE == 51966 | |
| # CDB: Write(10): 2a 08 DE AD BE EF 00 CA FE 00 |
| #!/bin/bash | |
| # Takes a screenshot, uploads via scp, puts url on the clipboard | |
| # Edit the code to set the scp destination and url format | |
| # | |
| # Bind it to a gnome keyboard shortcut for speedy screen sharing | |
| # | |
| # Ridiculously this needs bash, gnome-screenshot, xclip, scp, notify-send, sha256sum AND Ruby | |
| set -e |
| #cloud-config | |
| growpart: | |
| mode: off |
| # curl -XGET 'localhost:9200/test/_analyze?pretty=true&analyzer=standard' -d 'john.smith@example-one.com' | |
| { | |
| "tokens" : [ { | |
| "token" : "john.smith", | |
| "start_offset" : 0, | |
| "end_offset" : 10, | |
| "type" : "<ALPHANUM>", | |
| "position" : 1 | |
| }, { | |
| "token" : "example", |
| -- Logs begin at Wed 2013-10-16 23:08:37 UTC, end at Wed 2013-10-16 23:12:45 UTC. -- | |
| Oct 16 23:09:05 srv-5ai7t systemd[1]: Starting etcd... | |
| Oct 16 23:09:05 srv-5ai7t systemd[1]: Started etcd. | |
| Oct 16 23:09:05 srv-5ai7t etcd-bootstrap[649]: trying 10.242.48.122:7001 | |
| Oct 16 23:09:05 srv-5ai7t etcd-bootstrap[649]: + exec /usr/bin/etcd -d /var/lib/etcd -f -cl 0.0.0.0 -n 10.241.16.190 -c 10.241.16.190:4001 -s 10.241.16.190:7001 -sl 0.0.0.0 -C 10.242.48.122:7001 | |
| Oct 16 23:09:05 srv-5ai7t etcd-bootstrap[649]: [etcd] Oct 16 23:09:05.307 INFO | Wrote node configuration to '/var/lib/etcd/info' | |
| Oct 16 23:09:05 srv-5ai7t etcd[649]: Wrote node configuration to '/var/lib/etcd/info' | |
| Oct 16 23:09:05 srv-5ai7t etcd-bootstrap[649]: [etcd] Oct 16 23:09:05.312 INFO | etcd server [name 10.241.16.190, listen on 0.0.0.0:4001, advertised url http://10.241.16.190:4001] | |
| Oct 16 23:09:05 srv-5ai7t etcd[649]: etcd server [name 10.241.16.190, listen on 0.0.0.0:4001, advertised url http://10.241.16.190:4001] | |
| Oct 16 23:09:05 srv-5a |
| irb(main):001:0> require 'shellwords' | |
| => true | |
| irb(main):002:0> 'once upon "a time" there was\ a\ giant'.shellsplit | |
| => ["once", "upon", "a time", "there", "was a giant"] | |
| irb(main):003:0> puts "one upon a time there was a giant & 'her dog' `hack`".shellescape | |
| one\ upon\ a\ time\ there\ was\ a\ giant\ \&\ \'her\ dog\'\ \`hack\` | |
| irb(main):004:0> ["ls", "/home/john/secret stuff/"].shelljoin |