Skip to content

Instantly share code, notes, and snippets.

View chaserx's full-sized avatar
:octocat:
Mostly Meetings. Sometimes not.

Chase Southard chaserx

:octocat:
Mostly Meetings. Sometimes not.
View GitHub Profile
@chaserx
chaserx / Gemfile
Last active April 14, 2023 13:49 — forked from akshayvadher-BTC/sample_qr.rb
Generate QR code
# frozen_string_literal: true
source "https://rubygems.org"
gem "prawn"
gem "prawn-qrcode"
gem "matrix"
# {{date}}
[[{{Yesterday}}|<]] | {{date}} | [[{{Tomorrow}}|>]]
## Gratitude
- I am grateful for:
- ...
## Target(s)
- [ ] Goal
@chaserx
chaserx / gist:6ab418638f0daabede8efc8f741a389b
Created October 27, 2019 17:13
Extract relevant info from AWS CLI with jq
aws ec2 describe-instances --profile=chaserx | jq '.Reservations[].Instances[] | { instance: .InstanceId, publicip: .PublicIpAddress, privateip: .PrivateIpAddress, publicDNS: .PublicDnsName, tags: .Tags, state: .State.Name }'
@chaserx
chaserx / .irbrc
Created March 9, 2019 21:38
irb + awesome_print
# awesome print
begin
require 'awesome_print'
AwesomePrint.irb!
rescue LoadError => err
warn "Couldn't load awesome_print: #{err}"
end
@chaserx
chaserx / The Ten Commandments of Egoless Programming.md
Last active March 4, 2021 07:53
The Ten Commandments of Egoless Programming

The Ten Commandments of Egoless Programming

  1. Understand and accept that you will make mistakes. The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry. We can, and should, learn, laugh, and move on.

  2. You are not your code. Remember that the entire point of a review is to find problems, and problems will be found. Don’t take it personally when one is uncovered.

  3. No matter how much "karate" you know, someone else will always know more. Such an individual can teach you some new moves if you ask. Seek and accept input from others, especially when you think it’s not needed.

  4. Don’t rewrite code without consultation. There's a fine line between "fixing code" and "rewriting code." Know the difference, and pursue stylistic changes within the framework of a code review, not as a lone enforcer.

@chaserx
chaserx / sunday_ticket_scraper.rb
Created September 5, 2014 03:45
table to array of hashes example
#!/usr/bin/env ruby -wKU
# gems required:
# - nokogiri
# - awesome_print
# - open-uri-cached
require 'nokogiri'
require 'open-uri'
require 'awesome_print'
@chaserx
chaserx / keybase.md
Created August 18, 2014 13:50
verifying keybase.io identity

Keybase proof

I hereby claim:

  • I am chaserx on github.
  • I am chaserx (https://keybase.io/chaserx) on keybase.
  • I have a public key whose fingerprint is C680 33F7 E216 251D F7E5 C95E A91D 479C 048F 7ACA

To claim this, I am signing this object:

@chaserx
chaserx / downloader.rb
Created June 26, 2014 01:54
download all images from a web page via img src using nokogiri and mechanize
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'uri'
require 'mechanize'
require 'pathname'
# inspired by: http://stackoverflow.com/a/7933585/281699
class Downloader
def make_absolute href, root
// Random Heart
// random hearts for you
int number = 128;
float x;
float y;
float a;
// http://www.colourlovers.com/palette/1099931/be_my_valentine
color[] palette = { color(247,162,185), color(242,100,122), color(221,38,32), color(146,2,0) };
@chaserx
chaserx / failed_ftp_recursive_deletes.rb
Created July 19, 2013 14:19
various failed attempts to remove non-empty folder via FTP cobbled together from example code and internal methods from various stackoverflow answers and gems.
REGEX = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<filename>.+)$/
def delete_directory_contents(path, verbose = true)
# files = @ftp_conn.nlst(path)
# files.each do |file|
# if directory?("#{path}/#{file}")
# delete_directory_contents "#{path}/#{file}"
# @ftp_conn.rmdir("#{path}/#{file}")
# else
# @ftp_conn.delete("#{path}/#{file}")
# end