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 / resource.json
Created October 7, 2016 21:45
Idea for IPT api
{
"ipt":{
"name":"",
"link":"http://localhost:8080",
"root":"http://localhost:8080/api/resources"
},
"resource":{
"data":{
"shortname":"tes1",
"eml":{
@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 */
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
@diogok
diogok / fill.js
Created May 10, 2017 14:22
Zendesk new request filler
location
.search
.match(/([^&=?]+)=([^&]+)/g)
.map(function(kv) {
return kv.split("=")
}).map(function(kv) {
document.getElementById(kv[0]).value = decodeURIComponent(kv[1]).replace("+", " ")
});
// Usage: https://myohmy.zendesk.com/hc/pt-br/requests/new?request_anonymous_requester_email=joe@zendesk.com&request_custom_fields_77509687=Diogo+Silva&request_subject=Help+me
@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
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'services'
consul_sd_configs:
- server: 'host:8500'
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*,prometheus,.*
action: keep
@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"),
global:
scrape_interval: 5s
scrape_configs:
- job_name: nomad_metrics
params:
format:
- prometheus
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /v1/metrics
[rabbitmq_federation_management,rabbitmq_management,rabbitmq_mqtt,rabbitmq_stomp,rabbitmq_peer_discovery_consul].