Skip to content

Instantly share code, notes, and snippets.

View giovaneliberato's full-sized avatar

Giovane Liberato giovaneliberato

View GitHub Profile
@giovaneliberato
giovaneliberato / cli_wrapper.go
Last active May 26, 2021 11:59
Golang cli wrapper for Mac M1 chips - Add -tags=dynamic required by some libraries
// Installation
// - go build cli_wrapper.go
// - mv cli_wrapper go
// - export PATH=`pwd`:$PATH
package main
import "fmt"
import "os"
#!/usr/bin/env bash
LINKS="https://petsymposium.org/2018/files/papers/issue4/popets-2018-0035.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0033.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0031.pdf,https://petsymposium.org/2018/files/papers/issue1/paper42-2018-1-source.pdf,https://petsymposium.org/2018/files/papers/issue3/popets-2018-0021.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0029.pdf,https://petsymposium.org/2018/files/papers/issue3/popets-2018-0020.pdf,https://petsymposium.org/2018/files/papers/issue3/popets-2018-0026.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0039.pdf,https://petsymposium.org/2018/files/papers/issue1/paper12-2018-1-source.pdf,https://petsymposium.org/2018/files/papers/issue3/popets-2018-0027.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0037.pdf,https://petsymposium.org/2018/files/papers/issue3/popets-2018-0024.pdf,https://petsymposium.org/2018/files/papers/issue4/popets-2018-0
@giovaneliberato
giovaneliberato / builder.py
Last active December 5, 2016 20:38
Lombok's builder-like class made with python
class Builder(object):
_fields = None
_to_build = None
def __init__(self, to_build):
self._fields = []
self._to_build = to_build
def _add_field(self, name):
def inner(value):
set nocompatible
syntax on
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-pathogen'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
@giovaneliberato
giovaneliberato / multimethod.py
Created September 23, 2015 14:15
python multimethod pattern
# def collide(thing1, thing2):
# if thing1.is_asteroid() and thing2.is_spaceship():
# thing2.destroy()
# elif thing1.is_spaceship() and thing2.is_asteroid():
# thing1.destroy()
# elif thing1.is_spaceship() and thing2.is_spaceship():
# random.choice([thing1, thing2]).desmaterialize()
# elif thing1.is_asteroid() and thing2.is_asteroid():
# universe.boom()
# structured approach
#!/usr/bin/env bash
if [ "$1" == "green" ] ; then
curl -X POST --data-urlencode "payload={\"text\": \"Build is GREEN! Uhuull.\"}" <your-url>
elif [ "$1"== "red" ] ; then
curl -X POST --data-urlencode "payload={\"text\": \"Build is RED!!!\"}" <your-url>
fi
[
{ "keys": ["alt+a"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["alt+left"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["alt+right"], "command": "focus_group", "args": { "group": 1 } },
]
@giovaneliberato
giovaneliberato / slice_json.py
Last active August 29, 2015 14:08
Slice json files in small pieces
import json
with open("erbopencellid.json") as fixtures:
conteudo = json.loads("".join(fixtures.readlines()))
tamanho = len(conteudo)
inicio = 0
range_ = fim = tamanho / 10
for i in range(1, 11):
fname = "erbopencellid%d.json" % i
print fname, inicio, fim
angular.forEach($scope.msg_filtradas, function(m){
var url = buscar_todos_pontos_url + m.pk + "/";
$http.get(url).success(function(data){
m.data = data;
})
})