Skip to content

Instantly share code, notes, and snippets.

@skout23
skout23 / tzgeoip.rb
Created March 9, 2012 01:50
simple silly daemon to set the tz based on current geoip osx only atm, but easy enough to switch up for other os's
#!/usr/bin/env ruby
require 'rubygems'
require 'geoip'
# install rubygems and geoip gem
# grab geoip db before
#
# wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# gunzip GeoLiteCity.dat.gz in same folder as this script
@skout23
skout23 / manage_snapshots.rb
Last active October 6, 2015 13:38
AWS ec2 EBS snapshot management
#!/usr/bin/env ruby
# cleaned up a bit, makes use of memoize to better handle queries to the EC2 backend, less calls == faster.
require 'rubygems'
require 'aws-sdk'
regions = [
"ec2.us-east-1.amazonaws.com",
@skout23
skout23 / avg_student_count.rb
Created October 12, 2012 18:09
Clever API quickie
require 'json'
require 'rest-client'
=begin
{"data"=>
{"district"=>"4fd43cc56d11340000000005",
"school"=>"4fee004cca2e43cf27000002",
"name"=>"Advanced Literature 1(B)",
"teacher"=>"4fee004dca2e43cf270007e8",
# act like GNU screen
unbind C-b
set -g prefix C-a
# look good
set -g default-terminal "screen-256color"
# Allows for faster key repetition
set -s escape-time 0

Keybase proof

I hereby claim:

  • I am skout23 on github.
  • I am skout23 (https://keybase.io/skout23) on keybase.
  • I have a public key ASDw8P2ph2XFQLlCW0GtGhnuJZlOBN6nQMSmPzXH_VPlYAo

To claim this, I am signing this object:

@skout23
skout23 / notsecret.rb
Created June 16, 2014 16:34
silly base64decode(rot13()) for when I post bday stuff on friends fb
#!/usr/bin/env ruby
# silly base64decode(rot13())
require 'base64'
string = "VW5jY2wgT3ZlZ3VxbmwgTnkh"
plain = Base64.decode64(string).to_s.tr 'A-Za-z','N-ZA-Mn-za-m'
puts plain
@skout23
skout23 / get_vm_list
Created September 2, 2014 21:13
silly wrapper for azure vm list to a hash.
~$ azure vm list
info: Executing command vm list
data: DNS Name VM Name Status
data: -------------------------------- ----------- ---------
data: my-vm-name.cloudapp-preview.net my-vm0 ReadyRole
data: my-vm-name.cloudapp-preview.net my-vm1 ReadyRole
data: my-vm-name.cloudapp-preview.net my-vm2 ReadyRole
data: my-vm-name.cloudapp-preview.net my-vm3 NotReady
data: my-vm-name.cloudapp-preview.net my-vm4 ReadyRole
data: my-vm-name.cloudapp-preview.net my-vm5 ReadyRole
@skout23
skout23 / gimmetime.rb
Created October 7, 2014 16:27
stupid import thing
#!/usr/bin/env ruby
require 'time'
$output = File.open("tstamp.csv",'w')
$input = File.open("dork.in",'r')
def gimmetime(str)
d1 = Time.parse(str)
rm1 = Random.new
@skout23
skout23 / codewatcher.rb
Created October 29, 2014 23:33
simple-ish rss atom feed watcher to alert when a code change has taken place
# script to watch production code commit log and send a diff of if any changes for PCI regulation needs
require 'rss'
require 'openssl'
DEBUG = false
# set the local store for marshalled data
$prod_code_last_reported_date = '/home/someuser/bin/watch_rss/data/last_reported.yml'
@skout23
skout23 / mario.rb
Created August 7, 2015 09:56
quick poc to print out the mario half pyramid
#!/usr/bin/env ruby
#
# quick poc to print out the mario half pyramid
#
#
def pymid(base)
1.upto(base) do |row|
str = "#" * row