Skip to content

Instantly share code, notes, and snippets.

View diogok's full-sized avatar

Diogo Souza da Silva diogok

View GitHub Profile

Keybase proof

I hereby claim:

  • I am diogok on github.
  • I am diogok (https://keybase.io/diogok) on keybase.
  • I have a public key whose fingerprint is 4C89 B726 35A1 20FB EF3D F930 2DC2 9FBA BA1C 84DD

To claim this, I am signing this object:

@diogok
diogok / geo_files_sizes
Last active November 10, 2017 04:37
Comparing file size for geospatial data for GeoJSON, TopoJSON, KML, CSV with WKT, SQLite/Spatialite and original shapefile. All with and without compression, none simplified.
88K ucs_mma_28012015.attributes.csv.gz
352K ucs_mma_28012015.topo.json.gz
460K ucs_mma_28012015.attributes.csv
2,8M ucs_mma_28012015.topo.json
16M ucs_mma_28012015.spatial.deflate.db
26M ucs_mma_28012015.spatial.db
31M ucs_mma_28012015.wkt.csv.gz
31M ucs_mma_28012015.kml.gz
31M ucs_mma_28012015.geo.json.gz
38M ucs_mma_28012015.wkb.db
@diogok
diogok / index.html
Created July 13, 2015 16:05
Grafico de contagem de downloads do gbif
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contador de Downloads de recurso do GBIF</title>
</head>
<body>
<canvas id="myChart" width="700" height="300"></canvas>
@diogok
diogok / README.md
Created June 6, 2014 20:23
No name

README is empty

@diogok
diogok / docker2etcd.rb
Last active August 29, 2015 14:01
More complete "docker inspect" into etcd
#!/usr/bin/env ruby
require 'uri'
require 'json'
require 'net/http'
def http_get(uri)
JSON.parse(Net::HTTP.get(URI(uri)))
end
@diogok
diogok / ruby.sh
Created April 3, 2014 01:20
Ruby and rbenv setup, for vagrant.
#!/usr/bin/env bash
# basic ruby
apt-get update
apt-get install aptitude libxslt-dev libxml2-dev ruby ruby1.9.1-dev libssl-dev build-essential -y
# config ruby gems to https
gem sources -r http://rubygems.org
gem sources -r http://rubygems.org/
gem sources -a https://rubygems.org
@diogok
diogok / etcd-to-env.sh
Last active December 6, 2015 07:55
Register running docker containers and vagrant vms into ETCD and reads them out into ENVironment vars.
#!/bin/bash
# this script tries to turn your etcd into env vars
[[ ! $EHOST ]] && EHOST="$(hostname -I | awk '{ print $1 }')"
[[ ! $EPORT ]] && EPORT=4001
[[ ! $ETCD ]] && ETCD="http://${EHOST}:$EPORT"
ETCD_FILE="/tmp/$(date +%s).etcd.json"
wget "$ETCD/v2/keys/?recursive=true" -O $ETCD_FILE
<?php
namespace cncflora\repository;
class Profiles {
public $user = null;
public $couchdb = null;
public $db = null;
public function __construct($user=null) {
@diogok
diogok / OnlineUsers.php
Created May 4, 2011 19:48
Online Users using PHP and Redis
<?php
include 'predis/predis.phar';
class OnlineUsers {
/* time to consider user online */
private $minutes = 5 ;
function online() {
/* current hour and minute */
@diogok
diogok / proxy.lua
Created April 15, 2011 17:09
Simple HTTP reverse proxy in Lua
#!/usr/bin/env lua
require 'socket'
require 'copas'
assert(arg[1],"Must pass host and port to listen")
assert(arg[2],"Must pass host and port to proxy")
local config = {
newhost=string.gsub(arg[1],"([^:]+):(%d+)","%1"),
newport=string.gsub(arg[1],"([^:]+):(%d+)","%2"),