Skip to content

Instantly share code, notes, and snippets.

View renanbastos93's full-sized avatar
🏄‍♂️
Free times I go surfing usually

Renan Bastos renanbastos93

🏄‍♂️
Free times I go surfing usually
View GitHub Profile
@crgimenes
crgimenes / main.go
Created May 21, 2020 21:11
Detect server and client ip and port
package main
import (
"fmt"
"net"
"net/http"
"github.com/gorilla/mux"
)
@Biazus
Biazus / builder.py
Created March 21, 2020 23:55
Sample of builder design pattern
#!/usr/bin/env python3
from abc import ABC, abstractmethod
class AbstractEdgeBuilder(ABC):
@abstractmethod
def build_edge(self):
pass
@Biazus
Biazus / abstract_factory_azion.py
Last active March 12, 2020 18:32
Sample of abstract factory by Miller Biazus
#!/usr/bin/env python3
from abc import ABC, abstractmethod
class AbstractFunction(ABC):
@abstractmethod
def install_function(self):
pass
@nbari
nbari / gist:386af0fa667ae03daf3fbc80e3838ab0
Created July 2, 2016 07:56 — forked from juanqui/gist:7564275
Golang Kqueue Snippet
// helpful links:
// https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/EV_SET.2.html
// http://julipedia.meroh.net/2004/10/example-of-kqueue.html
// create kqueue
kq, err := syscall.Kqueue()
if err != nil {
log.Println("Error creating Kqueue descriptor!")
return
}
@boniattirodrigo
boniattirodrigo / removerAcentosECaracteresEspeciais.py
Last active December 28, 2023 18:38
Remover acentos e caracteres especiais em Python
import unicodedata
import re
"""
A remoção de acentos foi baseada em uma resposta no Stack Overflow.
http://stackoverflow.com/a/517974/3464573
"""
def removerAcentosECaracteresEspeciais(palavra):
@TheGU
TheGU / uploader.go
Created September 11, 2015 10:07
Golang to upload file to google drive with progress bar using Google API
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@vsouza
vsouza / .bashrc
Last active April 9, 2024 05:27
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@gordonbrander
gordonbrander / route.js
Last active April 30, 2022 01:26
route.js: a history.pushState microrouter without the routing fluff.
// Microrouter based on history.pushState.
// All thrills, no frills.
// Usage:
//
// var h = urlstate(callback);
// h.push('#foo')
function urlstate(callback) {
// Since `history.pushState` doesn't fire `popstate`, we can use this function
// instead. Will update history state and call `callback` with currently
// showing `url`.