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
@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
@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'
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease -O /tmp/InRelease.xyz
if test /tmp/InRelease.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
@jrgifford
jrgifford / openssl-fix.yml
Last active May 3, 2016 17:22 — forked from carsongee/openssl-fix.yml
CVE-2016-2108 SSL Ansible check and correct play for Ubuntu
---
# Patches openssl problem and restarts needed services
- name: Apply common configration to all nodes
hosts: all
sudo: yes
# Uncomment to apply update one server at a time
# serial: 1
tasks:
- name: "Install packages and update cache"
@jrgifford
jrgifford / -
Created March 19, 2016 00:25 — forked from zenhob/-
#!/bin/sh
#
# Patches and installs Ruby to expose OpenSSL context options, using rbenv.
#
# Based on http://philippe.bourgau.net/how-to-install-a-patched-ruby-interpreter-wit/
#
VERSION=2.1.6
PATCH_URL="https://bugs.ruby-lang.org/attachments/download/4210/0001-Expose-the-SSLContext-options-attribute-in-Net-HTTP.patch"
PATCH_NAME=ssloptions
@jrgifford
jrgifford / friday_deploy_cap2.rb
Created January 22, 2016 18:08 — forked from exAspArk/friday_deploy_cap2.rb
Friday deploy script for Capistrano
# Capistrano 2
before "deploy", "friday:good_luck"
namespace :friday do
friday_jumper = %{
┓┏┓┏┓┃
┛┗┛┗┛┃⟍ ○⟋
┓┏┓┏┓┃ ∕ Friday
┛┗┛┗┛┃ノ)
@jrgifford
jrgifford / gist:6e3cfb2f3edb645fc804
Created December 28, 2015 18:47 — forked from tinogomes/gist:1182499
credit card validation on ruby
# References
# http://en.wikipedia.org/wiki/Bank_card_number
# http://en.wikipedia.org/wiki/Luhn_algorithm
def valid_credit_card?(number)
number = number.to_s.gsub(/\D/, "")
return false unless valid_association?(number)
number.reverse!
@jrgifford
jrgifford / pdfx.rb
Last active August 31, 2015 20:55 — forked from fidothe/pdfx.rb
Worked example for creating a PDF/X-1a:2003 document with Prawn
require 'prawn'
require 'prawn/measurements'
# I have a small collection of links to the resources I used to figure all
# this out: http://pinboard.in/u:fidothe/t:pdfx
module PDFX
class PageBox
include Prawn::Measurements
attr_reader :bleed_mm