Skip to content

Instantly share code, notes, and snippets.

View dvliman's full-sized avatar

David Liman dvliman

View GitHub Profile
// Write a program that converts a human readable column header into a column index.
// A column header is an arbitrary length string of the characters A through Z, e.g: "A", "B", "AB", "BA" or "AAK".
// A represents the first column and its index is 1, B is the second with an index of 2, AA is the 27th column, etc.
// The program should read the column header from standard in and print the result to standard out as a string of digits.
// Given an input string of "A" the program should output only "1".
//
// Note that you can compile and test your code in the browser multiple times before submitting.
import java.io.BufferedReader;
@dvliman
dvliman / gist:9235978
Created February 26, 2014 18:54
edge css
/* normalize.css v2.1.0 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary {
display: block
}
audio,canvas,video {
display: inline-block
}
audio:not([controls]) {
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@dvliman
dvliman / gist:10789981
Created April 15, 2014 23:47
Google API services
Google Cloud SQL ON
Google Cloud Storage ON
Google Cloud Storage JSON API ON
Google Compute Engine ON
Ad Exchange Seller API
Admin SDK
AdSense Host API
AdSense Management API
Analytics API
Audit API
@dvliman
dvliman / crdt system
Last active August 29, 2015 14:01 — forked from pozorvlak/sitrep.md
Here's where I understand the state of the art to be:
- In [this INRIA tech report](http://hal.inria.fr/docs/00/55/55/88/PDF/techreport.pdf), Shapiro, Preguiça, Baquero and Zawirski (SPBZ) prove, amongst other things, that a sufficient condition for CRDTs to achieve eventual consistency on networks which may reorder and duplicate packets (which I'll call **flaky** networks, henceforth) is that
1. the underlying datatype forms a semilattice,
2. messages are full states,
3. incoming messages are combined with the node's current state using the least-upper-bound operation in the semilattice.
- It's possible to relax condition 2 and still achieve eventual consistency over flaky networks by fragmenting the state into independent parts and transmitting updates to each part separately. For instance, in the G-Set CRDT (an add-only bitset) one can transmit only the index of the element to be added.
- In [these slides from a talk at Dagstuhl](http://www.dagstuhl.de/mat/Files/13/13081/13081.BaqueroCarlos.Sl
@dvliman
dvliman / gist:abcf784a69450e47059b
Last active August 29, 2015 14:01
scala future
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.concurrent
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2008-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala.util
RATE_LIMIT_SCRIPT = r'''
local now = tonumber(ARGV[1])
local required = tonumber(ARGV[2])
local rate = tonumber(ARGV[3])
local per_secs = tonumber(ARGV[4])
local do_subtract = tonumber(ARGV[5]) == 1
local full_at = tonumber(redis.call('GET', KEYS[1])) or 0
local score, result
if full_at < now then
score = rate
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Update: changed because the old IP-service wasn't working anymore
# Uses curl to be compatible with machines that don't have wget by default
# modified by Ross Hosman for use with cloudflare.
#
# Place at:
# /usr/local/bin/cf-ddns.sh
# run `crontab -e` and add next line:
# 0 */5 * * * * /usr/local/bin/cf-ddns.sh >/dev/null 2>&1
{
"_id" : "bpc.views.merchant.abc-def.2014.6.12",
"daily" : {
"2" : 1
},
"updated_on" : "2014-06-12T21:38:22.620-08:00"
}