Skip to content

Instantly share code, notes, and snippets.

dayyan / micropush_fetch.rb
Created Feb 6, 2018
Fetch Micropsuh Tokens
View micropush_fetch.rb
require 'aws-sdk'
# This assumes you have ~/.aws/credentials with a profile called production
# granting you read access to the DynamoDB resource.
client = 'us-west-2', profile: 'production')
MC_4501 = %w(
View gist:22ff4076e796910faeb1
args */**/*.coffee
argdo %s/find/replace/ge
View gist:14080e5a3e682ad5e619
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed
View gist:e62bddc65ce1af735f0f
  1. Configure Gmail in you gitconfig:
  smtpserver =
  smtpserverport = 587
  smtpencryption = tls
  smtpuser = <gmail email address>
  from = <email address for From: field>
View .irbrc
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 99999
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
dayyan / gist:5556332
Created May 10, 2013
Replace double quotes in all non-interpolated strings to single quotes in vim.
View gist:5556332
View append sha1sum
find . -name '*.*' -type f -print | while read file; do
hash=$(sha1sum $file | awk '{print $1}');
mkdir -p hashed;
cp $file hashed/${file%.*}-$hash.${file/*.};
dayyan / gist:4040897
Created Nov 8, 2012
Remove incorrect varnish and install correct version
View gist:4040897
// chef recipe installed latest varnish by default which is broken, revert to 2.10
for i in {list of servers}; do ssh root@$i "export DEBIAN_FRONTEND=noninteractive; sudo apt-get -q -y remove varnish; sudo apt-get -q -y install libvarnish1=2.1.0-2ubuntu0.1; sudo apt-get -q -y install varnish=2.1.0-2ubuntu0.1"; done;
// may want to remove varnish config files prior if defaults are going to be used
dayyan / gist:4035715
Created Nov 8, 2012
Regular Expression Vim: Capistrano role from server IP paste with comments for internal IPs from Chef
View gist:4035715
:'<,'> s/x\(.*ACTIVE | \)\(.\{-}\d\)\s*| \(.*\)/role :app, '\2', # \1 \3/
x| 1111 | yyy-yyy-staging-app83 | ACTIVE | | |
role :app, '' # | 1111 | xxx-xxx-staging-app83 | ACTIVE | |
dayyan / pinterest_urls.js
Created May 15, 2012
Pinterest urls in Javascript
View pinterest_urls.js
/* Pinterest urls need to be URI encoded, then URI component encoded.
replace('{shareUrl}', escape(shareObj.shareUrl)).replace('{imageUrl}', encodeURIComponent(encodeURI(shareObj.imageUrl))).replace('{shareText}', escape(shareObj.shareText));