Skip to content

Instantly share code, notes, and snippets.

@hvergara
hvergara / keybase.md
Created April 30, 2014 16:04
keybase.md

Keybase proof

I hereby claim:

  • I am hvergara on github.
  • I am hvergara (https://keybase.io/hvergara) on keybase.
  • I have a public key whose fingerprint is C52A 8BCD 2E3B CFD3 F5B7 88EB 7CA0 3876 864B A82F

To claim this, I am signing this object:

@hvergara
hvergara / santiago.py
Last active August 29, 2015 14:12
PyBikes Santiago test
import pybikes
santiago = pybikes.getBikeShareSystem('bcycle', 'santiago')
santiago.update()
for station in santiago.stations:
print station
var latency = new SpeedTest.Latency('samples/empty.bin?' + Math.random());
latency.on('finish', function(size, time) {
console.log('Latency: ' + time + ' ms');
}
var download = new SpeedTest.Download('samples/8mb.bin?' + Math.random());
download.on('progress', function(loaded, total, rate) {
var percent = Math.round(loaded / total * 100),
kbps = Math.round(rate / 1024);
console.log(percent + ' loaded at ' + kbps + ' kbps')
}
@hvergara
hvergara / gist:1404796
Created November 29, 2011 13:23 — forked from KristianLyng/gist:1404599
VCL state diagram
.-----------------.
.----------| receive request |
v '-----------------'
.--------------.
| vcl_recv | Varnish 3.0 state diagram
.-----------|--------------|-------------. Not entierly complete.
| | req | | Misses error/restart and
v '--------------' v some internals
pass lookup pipe
| | |
@hvergara
hvergara / gist:1690368
Created January 27, 2012 19:04
generic init.d script
#! /bin/sh
###
# chkconfig: 235 98 55
# description: Your service
###
NAME="your service name"
DAEMON=/usr/bin/service
PIDFILE=/var/run/service.pid
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
{
"10101": {
"nombre": "Puerto Montt",
"distrito": 57,
"circunscripcion": 17,
"prov_id": 101
},
"10102": {
"nombre": "Calbuco",
"distrito": 57,
@hvergara
hvergara / getscript.js
Created September 27, 2012 04:16
getScript() - load scripts asynchronously w/375 bytes of code - e.g. `getScript(src, cb)`
// # getScript()
// more or less stolen from jquery core and adapted by paul irish
function getScript(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {
/\ /\
/ \ /\ / \
/ \ /\ / \ / \
/\/\/\/\ / \ /\/\/\ /\/\/\/\
////\\\\\\ /\/\/\ ////\\\\ /////\\\\\
/////\\\\\\\ ////\\\\ /////\\\\\ //////\\\\\\
//////\\\\\\\\/////\\\\\//////\\\\\\///////\\\\\\\
///////\\\\\\\\\////\\\\///////\\\\\\\//////\\\\\\\\
////////\\ AMARGA MARGA ////////\\\\\\\\/////\\\\\\\\\