Skip to content

Instantly share code, notes, and snippets.

View jrgifford's full-sized avatar
:shipit:
This is like AIM all over again, isn't it?

James Gifford jrgifford

:shipit:
This is like AIM all over again, isn't it?
View GitHub Profile
  • Weekly Agenda (created on a different day, and embedded with /Block Reference)
  • [[Morning Questions]]
    • {{[[slider]]}} How many hours of sleep did I get?
    • What's one thing top of mind today?
    • What's the one thing I need to get done today to make progress?
    • Review #[[Index: Questions]] #values
  • Agenda
    • {{[[TODO]]}} Morning walk #goal-health #habit
    • {{[[TODO]]}} Check calendar for scheduled events
  • {{[[TODO]]}} Morning focus hour
traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 64 hops max, 52 byte packets
1 10.249.192.1 (10.249.192.1) 10.257 ms 2.956 ms 3.158 ms
2 99-50-95-198.lightspeed.wlfrct.sbcglobal.net (99.50.95.198) 5.318 ms 5.032 ms 4.296 ms
3 104-189-208-1.lightspeed.clmboh.sbcglobal.net (104.189.208.1) 7.523 ms 10.622 ms 5.433 ms
4 71.151.141.238 (71.151.141.238) 6.387 ms 7.150 ms 7.824 ms
5 71.158.32.162 (71.158.32.162) 7.544 ms * *
6 71.158.32.171 (71.158.32.171) 7.652 ms 7.426 ms 6.287 ms
7 12.83.38.9 (12.83.38.9) 8.661 ms 6.480 ms
12.83.38.17 (12.83.38.17) 9.814 ms
@jrgifford
jrgifford / page_me.rb
Created December 15, 2019 00:01
PageMe - The Simple "Page somebody" library
require 'pry'
require 'socket'
class PageMe
def initialize(server:, pager:, port: 444)
@server = server
@pager = pager
@port = port
end
@jrgifford
jrgifford / sleep5.sh
Created June 12, 2019 17:18 — forked from jj1bdx/sleep5.sh
A shell one-liner for an infinite loop (sh/zsh/bash compatible)
while true; do date; sleep 5; done
def ​
puts "zero width space method"
end
@jrgifford
jrgifford / main.rb
Created April 10, 2019 13:59
Ruby CSV library is smart and will select just keys in the headers if given headers and a hash
require 'csv'
filename = "/tmp/csv_test.csv"
things_to_write = [
{a: "a", b: "b", c: "c"},
{c: "c", b: "b", a: "a", does_not: "exist"},
{a: "a", c: "c"}
]
CSV.open(filename, "wb", headers: things_to_write.first.keys) do |csv|
things_to_write.each do |thing|
@jrgifford
jrgifford / restore
Created February 10, 2017 03:12 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@jrgifford
jrgifford / Gemfile
Created February 1, 2017 20:03 — forked from somazx/Gemfile
Using Amazon Elasticsearch securely (signed requests) with Rails & searchkick gem on Heroku.
gem 'elasticsearch', '>= 1.0.15'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'patron'
gem 'faraday_middleware-aws-signers-v4'
gem 'searchkick'
params = {}
params[:start_date] = "2017/08/03"
params[:end_date] = "2017/08/05"
start_date = Date.parse(params[:start_date])
end_date = Date.parse(params[:end_date])
dates = (start_date..end_date).step(1.day).map { |date|
date.strftime('%y-%m-%d')
}
company_names = ["Tekfly", "Yabox", "Vinder", "Skiptube", "Fivespan"]
company_names.each do |company_name|
puts "#{company_name}"
end