Skip to content

Instantly share code, notes, and snippets.

View cfraizer's full-sized avatar

Colin Fraizer cfraizer

  • Indiana, US, Earth
View GitHub Profile
@cfraizer
cfraizer / instructions.md
Last active June 14, 2020 16:08
How to get your Twitter Archive Data

To get the archive that the Python script operates on:

  1. Visit https://twitter.com
  2. From the menu, select "More" → "Settings and privacy", which will take you to the Settings page.
  3. On the Settings page, pick "Your Twitter data" → "Download archive".

NOTE: You will get a tweet and an email when the data is ready to be downloaded. It will be a large ZIP file. When you unzip it, it does not create a directory to contain the contents, so you probably want to create a directory with a name like twitter, put the ZIP file in there, and then unzip it. (Cleverer ways to accomplish this in one sh command are left as an exercise for the reader.)

@cfraizer
cfraizer / sarc.sh
Last active June 4, 2020 16:17
Compare "pure" Bash vs call to `tr`
#!/usr/bin/env bash
foo() {
local value="The Quick Brown FOX umped over The Lazy Dog."
local -i loopCount=1000
local -i i=0
for (( i = 0; i < loopCount; ++i )); do
local newVal=""
newVal="${value,,}"
@cfraizer
cfraizer / jenks.sh
Created June 4, 2020 03:12
Pure Bash vs. Sed
foo() {
local -a statusValues=(
"Discharging"
"Not Charging"
"Charging"
"Unknown"
"Full"
)
@cfraizer
cfraizer / pretty.jq
Created August 20, 2019 18:20
first attempt at JSON prettifier in jq
# 9 = \t
# 10 = \n
# 13 = \r
# 32 = (space)
# 34 = "
# 44 = ,
# 58 = :
# 91 = [
# 92 = \
# 93 = ]
@cfraizer
cfraizer / gist:660633362006af2233ae2f1adf8ebf78
Created June 18, 2019 17:41
Using vault and jq to put secrets into environment variables:
$ vault kv get --format=json «path/to/secrets» | jq -r '.data.data | to_entries[] | "export \(.key)=\(@sh "\(.value)")"'
export AWS_REGION='us-west-2'
export CATEGORYUPDATEWORKER_POOLSIZE='10'
export DOMAINUPDATEWORKER_POOLSIZE='10'
@cfraizer
cfraizer / ace-ido.el
Created February 20, 2015 21:22
My version of glucas's functions
(require 'ace-window)
(defun ace-ido-find-file ()
"Ace ido-find-file."
(interactive)
(if (not (window-parent))
(ido-find-file-other-window)
(let ((start-window (selected-window)))
(unwind-protect
(progn
#!/usr/bin/osascript
tell application "System Events"
tell process "NotificationCenter"
set numwins to (count windows)
repeat with i from numwins to 1 by -1
click button "Close" of window i
end repeat
end tell
end tell