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 / 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 / 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 / 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
@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
@chaserx
chaserx / peach.txt
Created July 17, 2013 20:25
Parallel Each
# $ gem install peach
# $ irb
1.9.3-p448 :001 > require 'peach'
=> true
1.9.3-p448 :002 > ['a', 'b', 'c'].peach do |p|
1.9.3-p448 :003 > puts p
1.9.3-p448 :004?> end
a
cb
@chaserx
chaserx / capitalize.rb
Created July 17, 2013 16:28
Name Capitalization
# I <3 Ruby
"chase southard".split.map {|n| n.capitalize}.join(' ')
#=> "Chase Southard"
@chaserx
chaserx / fixture_set_test.sublime-snippet
Created December 13, 2012 21:57
Some Sublime Snippets
<snippet>
<content><![CDATA[
test '${1:truth}' do
set = fixture_set(${2:default})
assert true
end
]]></content>
<tabTrigger>fstest</tabTrigger>
<scope>source.ruby</scope>
<description>basic test with fixture set</description>