Skip to content

Instantly share code, notes, and snippets.

View dan's full-sized avatar
🕶️
Seeking restitution for my ruined rug.

Dan Benjamin dan

🕶️
Seeking restitution for my ruined rug.
View GitHub Profile
@dan
dan / mysql2.sh
Last active May 7, 2022 14:59
How to Install the mysql2 Gem on M1 Macs
brew install mysql openssl zstd
gem install mysql2 -v '0.5.4' -- --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config --with-ldflags="-L$(brew --prefix zstd)/lib -L$(brew --prefix openssl)/lib" --with-cppflags=-I$(brew --prefix openssl)/include
@dan
dan / podcastindex.rb
Last active September 11, 2020 23:15
require "net/http"
require "uri"
require "digest"
require "json"
api_key = "YOUR_API_KEY"
api_secret = "YOUR_API_SECRET"
api_header_time = Time.now.to_i.to_s
hash = Digest::SHA1.hexdigest("#{api_key}#{api_secret}#{api_header_time}")
#!/bin/sh
sed 's/\r//' $1 > old-emails.out
sed 's/\r//' $2 > new-emails.out
comm -13 old-emails.out new-emails.out > output.txt
rm -f old-emails.out new-emails.out
echo "Output results to output.txt."
@dan
dan / .bash_profile
Last active March 15, 2017 12:51
My current .bash_profile with rbenv, homebrew, and git integration.
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
alias ls="ls -GFh"
alias be="bundle exec"
export PATH=/usr/local/bin:/usr/local/heroku/bin:$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"
@dan
dan / deploy.rb
Created February 12, 2017 20:36
Deploy a static site with Capistrano 2
# For this to work, you'll need to change:
# :application
# :repository
# :deploy_to
# :user
# :app, :web, :db
set :application, "example.com"
set :repository, "[email protected]:you/example.git"
set :branch, "master"
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";
{
"always_show_minimap_viewport": true,
"auto_indent": true,
"auto_match_enabled": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Base16 Color Schemes/base16-default.dark.tmTheme",
"detect_indentation": false,
"draw_minimap_border": true,
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
@dan
dan / reserved_subdomains.txt
Created July 27, 2015 17:19
Reserved Subdomains
about
abuse
account
accounts
admin
administrator
administrators
admins
anonymous
api
@dan
dan / ffmpeg.sh
Last active August 29, 2015 14:07 — forked from ryanbillingsley/ffmpeg.sh
for i in "$@" ; do /Users/jsnell/ffmpeg -i "$i" -map 0:0 -acodec pcm_s161e -ac 1 -out_sample_rate 44100 "${i%.*}.wav" ;
done
require 'mp3info'
# some test data, replace it with your own data
title = "After Dark #388: After Back to Work"
subtitle = "Merlin & Dan talk after Back to Work episode 104."
artist = "Dan Benjamin on 5by5.tv"
album = "After Dark"
genre = "Podcast"
track = 338
year = 2013