Skip to content

Instantly share code, notes, and snippets.

/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */
var dbg = (typeof console !== 'undefined') ? function(s) {
console.log("Readability: " + s);
} : function() {};
/*
* Readability. An Arc90 Lab Experiment.
* Website: http://lab.arc90.com/experiments/readability
@prisoner
prisoner / redis-bitmaps-1.java
Last active December 20, 2015 19:09
Fast, easy, realtime metrics using Redis bitmaps
import redis.clients.jedis.Jedis;
import java.util.BitSet;
Jedis redis = new Jedis("localhost");
public int uniqueCount(String action, String date) {
String key = action + ":" + date;
BitSet users = BitSet.valueOf(redis.get(key.getBytes()));
return users.cardinality();
}
import redis.clients.jedis.Jedis;
import java.util.BitSet;
Jedis redis = new Jedis("localhost");
public int uniqueCount(String action, String... dates) {
BitSet all = new BitSet();
for (String date : dates) {
String key = action + ":" + date;
BitSet users = BitSet.valueOf(redis.get(key.getBytes()));
@prisoner
prisoner / display-indicator.py
Created March 6, 2017 02:05 — forked from philayres/display-indicator.py
Unity indicator for simple clock and date display
#!/usr/bin/env python
# Unity indicator for evolution-less clock and date display
# author: phil ayres
# 24 Oct 2011
import gobject
import gtk
import appindicator
import os, sys
import time
@prisoner
prisoner / config.json
Created May 27, 2017 01:29 — forked from twalker/config.json
inline-styles using phantomjs
{
"ignoreSslErrors": true,
"localToRemoteUrlAccessEnabled": true,
"webSecurityEnabled": false
}
@prisoner
prisoner / queue.go
Created January 10, 2019 08:03
queue with timeout
/*
* Copyright The Dragonfly Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software