Skip to content

Instantly share code, notes, and snippets.

View PaulCapestany's full-sized avatar

Paul Capestany PaulCapestany

View GitHub Profile
@PaulCapestany
PaulCapestany / gitcheats.txt
Created February 3, 2016 02:17 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# cherry pick range of commits, starting from the tip of 'master', into 'preview' branch
git rev-list --reverse --topo-order master... | while read rev; do git checkout preview; git cherry-pick $rev || break; done
# create tracking branches for all remote branches
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs;
# git reset newly added files
@PaulCapestany
PaulCapestany / bitcoin_startups
Created December 12, 2014 16:50
All bitcoin startups that have been added to AngelList, sorted by date
2011-10-06T08:09:18Z — Seventh Continent
2011-10-17T18:23:08Z — Bitcoin-2
2011-11-09T22:25:00Z — ZipZap
2011-12-14T20:44:52Z — SecondMarket
2011-12-26T03:44:39Z — Mirror
2012-01-18T03:02:01Z — Swarm
2012-02-19T05:12:56Z — Giftbit
2012-03-20T11:08:06Z — PAYMIUM
2012-05-15T05:39:16Z — MtGox
2012-05-22T22:46:44Z — Tradefor
@PaulCapestany
PaulCapestany / wwdc_2014_vids_hd.sh
Created June 6, 2014 21:13
Download every video presentation (high def) from WWDC 2014 with this quick one-liner shell script
for i in `curl https://developer.apple.com/videos/wwdc/2014/ | grep -oE 'ht.*?_hd.*?mov'`; do; curl -O $i; done
@PaulCapestany
PaulCapestany / wwdc_2014_vids_sd.sh
Created June 6, 2014 21:12
Download every video presentation (standard def) from WWDC 2014 with this quick one-liner shell script
for i in `curl https://developer.apple.com/videos/wwdc/2014/ | grep -oE 'ht.*?_hd.*?mov' | sed 's;_hd;_sd;'`; do; curl -O $i; done
@PaulCapestany
PaulCapestany / wwdc_2014_pdfs.sh
Created June 6, 2014 21:09
Download every session slide deck PDF from WWDC 2014 with this quick one-liner shell script
for i in `curl https://developer.apple.com/videos/wwdc/2014/ | grep -o 'ht.*pdf'`; do; curl -O $i; done
@PaulCapestany
PaulCapestany / satoshi_commits.txt
Created December 12, 2013 20:11
Satoshi Nakamoto's commit timestamps obtained via `git log --author="nakamoto" > ~/satoshi_commits.txt`
Wed Dec 15 22:43:51 2010 +0000
Mon Dec 13 16:26:14 2010 +0000
Sun Dec 12 18:38:02 2010 +0000
Sun Dec 12 18:20:36 2010 +0000
Wed Dec 8 23:23:48 2010 +0000
Mon Dec 6 15:59:28 2010 +0000
Sun Dec 5 09:29:30 2010 +0000
Sat Nov 27 23:12:41 2010 +0000
Thu Nov 25 20:41:57 2010 +0000
Thu Nov 25 16:40:25 2010 +0000
@PaulCapestany
PaulCapestany / folder_git.sh
Created September 19, 2013 20:56
Simple script to create a buncha git repos in a folder containing folders (each child folder becomes a git repo) and then creates and switches to a new branch. Useful when playing around with code tutorials for example.
for i in $(ls) ; do ; cd $i ; git init && git add . && git commit -a -m "Initial commit" && git branch myFork && git checkout myFork ; .. ; done ;
@PaulCapestany
PaulCapestany / get_and_delete_sync_gateway_docs.sh
Last active March 12, 2018 12:30
GET _all_docs from sync_gateway and parse with `jq`. Then, iterate through list to delete all/whichever docs you want to delete. More info in comments.
#!/bin/bash
##########
# README #
##########
# Make sure you've got the CLI tool `jq` installed
# ↳ http://stedolan.github.io/jq/
# (if you've got homebrew on your Mac just do → `brew install jq`)
@PaulCapestany
PaulCapestany / oi.js
Created August 4, 2013 00:43
Dan Kaminsky's DefCon RNG challenge
// TLDR: Oi, Barnes. We'll miss ya. Here's a grimy RNG in your honor.
// node oi.js or paste the below into your favorite browser's JS console.
// DEFCON CHALLENGE: Break this!
function millis() { return Date.now(); }
function flip_coin() { n=0; then = millis()+1; while(millis()<=then) { n=!n; } return n; }
function get_fair_bit() { while(1) { a=flip_coin(); if(a!=flip_coin()) { return(a); } } }
function get_random_byte(){ n=0; bits=8; while(bits--){ n<<=1; n|=get_fair_bit(); } return n; }
report_console = function() { while(1) { console.log(get_random_byte()); }}
@PaulCapestany
PaulCapestany / myconfig.json
Created July 12, 2013 19:24
sync_gateway config example
{
"interface": ":4984",
"adminInterface": ":4985",
"log": ["HTTP+", "CRUD+", "Auth+", "Changes+", "Access", "Attach"],
"databases": {
"myapp": {
"server": "http://localhost:8091",
"sync": `function(doc) {channel(doc.channels);}`
},
"grocerydemo": {