Skip to content

Instantly share code, notes, and snippets.

Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one

Generating push certificates:
Go to iOS developer portal, go to "App IDs", open the production app ID and open
settings. Click "create certificate" and follow instructions to get
aps_production.cer and aps_development.cer. Make sure you use distinctive names
with date in the CSR so you can find the things later.
Import generated .cer files into keychain.
In keychain, select "my certificates" on the left, and expand the "apple
var request = require('request')
var COOKIE = 'session=2.blahblahblah' // copy your site cookie in here
var CID = 1234; // copy the connection id here
var BID = 1234; // copy the buffer id here
var SINCE = +process.env.since // optional: set an environment variable "since" to offset the log
get_lines(SINCE);
function get_lines(beforeid) {
var headers = { 'Cookie': COOKIE }
"""
Given a list of scores, returns the index of one of those items at random,
biased towards the items with the highest scores.
e.g. random_index_with_bias([84, 62, 61, 67, 45])
To show it works, run it 1,000,000 times:
>>> scores = {}
>>> for i in range(1000000):