Skip to content

Instantly share code, notes, and snippets.

View diogok's full-sized avatar

Diogo Souza da Silva diogok

View GitHub Profile
@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
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 / 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 / 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":{

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:

<?php
namespace cncflora\repository;
class Profiles {
public $user = null;
public $couchdb = null;
public $db = null;
public function __construct($user=null) {
@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
@diogok
diogok / couchdb.clj
Created August 17, 2010 12:35
couchdb.clj
(ns couchdb
(:use clojure.data.json)
(:refer-clojure :exclude [get key]))
(defn server
"Wraps a server"
[host port] {:server (str "http://" host ":" port)})
(defn db
"Wraps a database on a server"
(ns twitter-search
(:require [clojure.contrib.json.read :as json])
(:require [clojure.contrib.http.agent :as http ])
(:import (java.net URL URLEncoder))
)
(defn search [word last-id]
(let [term (URLEncoder/encode word "UTF-8")
result (http/string (http/http-agent (str
"http://search.twitter.com/search.json?q="
<?php
$mail = "email@gmail.com" ;
$header = "From: email@gmail.com\n" ;
$msg = "Mensagem" ;
$subject = "Assunto" ;
mail($mail,$subject,$msg,$header);