Skip to content

Instantly share code, notes, and snippets.

View PaulCapestany's full-sized avatar

Paul Capestany PaulCapestany

View GitHub Profile
@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 / bitcoin_hashrate_vs_price.csv
Created April 12, 2021 22:06
Bitcoin Hashrate vs Price
We can't make this file beautiful and searchable because it's too large.
"id","block_number","block_hash","fee_total_sat","fee_total_btc","fee_total_usd","price_btc","fee_per_kb_usd","block_size","difficulty","hashrate_network","time"
1,0,"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",0,0,0,0,0,285,1,"7158279",
2,1,"00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",0,0,0,0,0,215,1,"7158279",
3,2,"000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd",0,0,0,0,0,215,1,"7158279",
4,3,"0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449",0,0,0,0,0,215,1,"7158279",
5,4,"000000004ebadb55ee9096c9a2f8880e09da59c0d68b1c228da88e48844a1485",0,0,0,0,0,215,1,"7158279",
6,5,"000000009b7262315dbf071787ad3656097b892abffd1f95a1a022f896f533fc",0,0,0,0,0,215,1,"7158279",
7,6,"000000003031a0e73735690c5a1ff2a4be82553b2a12b776fbd3a215dc8f778d",0,0,0,0,0,215,1,"7158279",
8,7,"0000000071966c2b1d065fd446b1e485b2c9d9594acd2007ccbd5441cfc89444",0,0,0,0,0,215,1,"7158279",
9,8,"00000000408c48f847aa786c2268fc3e6ec2af68e8468a34a28c61b7f1de0dc6",0,0,0,0
@PaulCapestany
PaulCapestany / wwdc_pdf_downloader.sh
Created June 15, 2013 00:13
Download all the WWDC session presentation PDFs with this one-line bash script. Simply "View Source" at https://developer.apple.com/wwdc/videos/ and Save as "wwdc_source", then run the script in terminal. Easy-peazy!
grep -o "devstreaming.*HD.mov" wwdc_source | sed 's/-HD.mov/.pdf/' > wwdc_PDF_urls && for URL in `cat wwdc_PDF_urls`; do curl -OL $URL; done
@PaulCapestany
PaulCapestany / ripgrep-in-emacs.md
Created March 8, 2018 19:19 — forked from pesterhazy/ripgrep-in-emacs.md
Using ripgrep in Emacs using helm-ag (Spacemacs)

Why

Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.

How

@PaulCapestany
PaulCapestany / Useful Alfred Custom Searches
Created June 18, 2012 21:13
Useful Alfred Custom Searches
Calendar Quick Add
http://www.google.com/calendar/event?ctext=+{query}+&action=TEMPLATE&pprop=HowCreated%3AQUICKADD
Crunchbase
http://www.crunchbase.com/search?query={query}
Google Three Month Search
http://www.google.com/search?q={query}&tbs=,qdr:m3
Google Year Search
@PaulCapestany
PaulCapestany / oh-my-zsh prompt
Created February 8, 2013 03:07
oh-my-zsh prompt with continuously updated timestamp for every executed command ☺ (useful for troubleshooting server requests/responses when comparing against their logs, for example)
# oh-my-zsh prompt
PROMPT='%{$fg[white]%}%* ◀ %U%(0?.%{$fg_bold[magenta]%}.%{$fg_bold[red]%})%c%u %{$fg[white]%}▶ %{$reset_color%}'
PROMPT2=' %{$fg_bold[magenta]%}%c %{$fg_bold[white]%}… %_ %{$fg[white]%}▶ %{$reset_color%}'
# continuously updated timestamp for every executed command ☺
schedprompt() {
emulate -L zsh
zmodload -i zsh/sched
integer i=${"${(@)zsh_scheduled_events#*:*:}"[(I)schedprompt]}
(( i )) && sched -$i

iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

This post by a security researcher who prefers to remain anonymous will elucidate concerns about certain problematic decisions Apple has made and caution about future decisions made in the name of “security” while potentially hiding questionable motives. The content of this article represents only the opinion of the researcher. The researcher apologises if any content is seen to be inaccurate, and is open to comments or questions through PGP-encrypted mail.



TL;DR

@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 / 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`)
import graphviz as gv
import sys
import json
graph = gv.Graph(format='svg')
lngraph = json.load(sys.stdin)
for node in lngraph['nodes']:
nodename = node['pub_key'][-6:]