Skip to content

Instantly share code, notes, and snippets.

View lleger's full-sized avatar

Logan Leger lleger

View GitHub Profile
@lleger
lleger / us_zones.ex
Created June 2, 2021 21:00
Elixir list of all US timezones
valid_us_zones = Enum.filter(Tzdata.zone_list(), fn tz ->
String.starts_with?(tz, "US")
end)
@lleger
lleger / us_states.ex
Created June 2, 2021 20:57
Elixir map of US states (and DC) with abbreviations
%{
AK: "Alaska",
AL: "Alabama",
AR: "Arkansas",
AZ: "Arizona",
CA: "California",
CO: "Colorado",
CT: "Connecticut",
DC: "District of Columbia",
DE: "Delaware",
@lleger
lleger / rename_phoenix_project.sh
Created April 9, 2020 21:09 — forked from krystofbe/rename_phoenix_project.sh
rename a phoenix 1.4 umbrella
#!/bin/bash
set -e
CURRENT_NAME="OldName"
CURRENT_OTP="old_name"
NEW_NAME="NewName"
NEW_OTP="new_name"
defmodule MySchema do
use Ecto.Schema
import Ecto.Changeset
@type t :: %__MODULE__{}
schema "my_schemas" do
field(:name, :string)
@lleger
lleger / sync-ssh-keys.sh
Created April 4, 2019 18:42
Sync SSH keys from an S3 bucket
#!/bin/sh -e
AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-west-1}
S3_BUCKET=team-ssh-keys
SSH_USER=${SSH_USER:-ubuntu}
MARKER="# KEYS_BELOW_MANAGED_BY_TEAM_SSH_KEYS"
KEYS_FILE=/home/$SSH_USER/.ssh/authorized_keys
TEMP_KEYS_FILE=$(mktemp /tmp/authorized_keys.XXXXXX)
PUB_KEYS_DIR=/home/$SSH_USER/.ssh/team_ssh_keys

Keybase proof

I hereby claim:

  • I am lleger on github.
  • I am lleger (https://keybase.io/lleger) on keybase.
  • I have a public key ASDAHgwY5QK1dPh0XDsZCx77MLHC0pYTzFb-HDq0BFllnAo

To claim this, I am signing this object:

@lleger
lleger / config.yml
Last active August 31, 2017 17:33
CircleCI 2.0 + CodeClimate
version: 2
jobs:
build:
steps:
- type: cache-restore
name: Restore Code Climate cache
key: v1-code-climate-0.1.4
- run:
name: Install Code Climate reporter
command: |

Get clues first:

$ grep "CLUE" crimescene

From Crime Scene Report #028615332953:

CLUE: Found a wallet believed to belong to the killer: no ID, just loose change, and membership cards for AAA, Delta SkyMiles, the local library, and the Museum of Bash History. The cards are totally untraceable and have no name, for some reason.

# better copy and past
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# improve colors
set -g default-terminal 'screen-256color'
@lleger
lleger / gist:4390d9f42a57984dc6d5
Created May 12, 2015 23:23
AR serialize json stacktrace
TypeError: no implicit conversion of Hash into String
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `initialize'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `new'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in `parse'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/json/decoding.rb:26:in `decode'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/coders/json.rb:9:in `load'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/type/serialized.rb:19:in `type_cast_from_database'
from /Users/loganleger/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/type/mutable.rb:5:in `type_cast_from_user'
from /Users/loganleger/.rbenv/v