Skip to content

Instantly share code, notes, and snippets.

Avatar

Diego Rabatone Oliveira diraol

View GitHub Profile
@diraol
diraol / quick-slugify.sh
Last active Feb 17, 2019 — forked from oneohthree/quick-slugify.sh
Quick bash slugify
View quick-slugify.sh
# POSIX Compatible
# Remove leading and trailing spaces and dashes
# also zsh compatible
echo " - - Esperança do vôo do avião - - " | iconv -t ascii//TRANSLIT | sed -E 's/[~\^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+\|-+$//g' | sed -E 's/^-+//g' | sed -E 's/-+$//g' | tr A-Z a-z
@diraol
diraol / keybase.md
Created Dec 28, 2018
keybase certification
View keybase.md

Keybase proof

I hereby claim:

  • I am diraol on github.
  • I am diraol (https://keybase.io/diraol) on keybase.
  • I have a public key ASAd47mpwKVkyZF9GXqivzXxxF21LRA3n8ZJ6RNYnwttmQo

To claim this, I am signing this object:

@diraol
diraol / build_nested_python_dict
Created Jan 9, 2018
Create a nested python dict from a list of items to be splitted
View build_nested_python_dict
# This gist shows how to build a nested python dict
# based on a string that will be splitted based on one specific character
# It can be a list, a dict or whatever you want to.
one_level_dict = {
'2.0/jobs/create': 'POST',
'2.0/jobs/list': 'GET',
'2.0/jobs/delete': 'POST',
'2.0/jobs/get': 'GET',
'2.0/jobs/reset': 'POST',
@diraol
diraol / Installing VIM with python3 (compiled from source)
Last active Sep 9, 2017
Install Vim 8 with Python 3, Ruby and Lua support on Debian
View Installing VIM with python3 (compiled from source)
sudo apt remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt install liblua5.1-dev luajit libluajit-5.1 python3-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~/tools
@diraol
diraol / 01_parse_of_pcaps.py
Last active Mar 22, 2017
Python code to parse PCAP files with openflow (1.0) messages
View 01_parse_of_pcaps.py
"""Small script to parse pcap openflow files with python-openflow library.
######################################################################
Copyright (C) 2016, Diego Rabatone Oliveira <diraol AT diraol DOT eng DOT br>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@diraol
diraol / Mailman_BanAll_and_Discard.js
Last active Apr 29, 2018
Mailman BanAll + Discard
View Mailman_BanAll_and_Discard.js
// Load a recent jquery version
var jq = document.createElement('script');
jq.src = "https://code.jquery.com/jquery-3.1.1.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// Wait until jquery is loaded before running the code below
window.setTimeout(()=>{
jQuery.noConflict();
// Check everyone for BAN
jQuery("input[name|='senderbanp']").attr('checked', true)
// Check everyone for filtering action
View Kyco_Handshake.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diraol
diraol / multiple_exceptions.py
Last active Jun 15, 2016 — forked from cemsbr/multiple_exceptions.py
Throw multiple validation errors
View multiple_exceptions.py
# based on http://stackoverflow.com/questions/6470428/catch-multiple-exceptions-in-one-line-except-block
class ValidationError(Exception):
def __init__(self, attribute_name, message):
self.attribute_name = attribute_name
self.message = message
def __str__(self):
return self.message
@diraol
diraol / Exemplodeuso.tex
Last active Aug 29, 2015
Macro para Requisitos de Engenharia de Software em LaTeX
View Exemplodeuso.tex
%%01
\vfill
\begin{Requisito}
\ReqTipo{funcional}%Tipo
\ReqNome{Cadastrar usuário}%Nome
%\ReqLabel{cadUsu}%Label
\ReqDescr{O usuário realiza seu cadastro na plataforma.}%Desc.
\ReqPrioridade{alta}%Prioridade
\ReqStatus{aprovado}%Status
\ReqEstabilidade{alta}%Estabilidade
@diraol
diraol / servidores_e_filiados
Created Nov 22, 2013
Servidores e Filiados
View servidores_e_filiados
{"PEN": {"INSTITUTO NACIONAL DE SEGURO SOCIAL": 6, "FUNDACAO OSWALDO CRUZ": 1, "FUND. INST. BRASIL. GEOG. E ESTATISTICA": 1, "UNIVERSIDADE FEDERAL DE GOIAS": 1, "INSTITUTO NAC. DE COLONIZ E REF AGRARIA": 1, "UNIVERSIDADE FEDERAL DO PARA": 3, "INSTITUTO FEDERAL DO PIAUI": 1, "UNIVERSIDADE FEDERAL DO CEARA": 6, "INSTITUTO FEDERAL DO PARANA": 1, "FUNDACAO UNIVERSIDADE DO MARANHAO": 1, "INSTITUTO FEDERAL DO CEARA": 2, "UNIVERSIDADE FED.DO TRIANGULO MINEIRO": 1, "MINISTERIO DA SAUDE": 6, "DEPARTAMENTO DE POLICIA FEDERAL": 9, "MINIST.DA CIENCIA, TECNOLOGIA E INOVACAO": 1, "MINISTERIO DA FAZENDA": 2, "FUNDACAO UNIVERSIDADE DE BRASILIA": 1, "MINIST.DA AGRICULTURA,PECUARIA E ABAST.": 1, "GOVERNO DO EX-TERRITORIO DE RORAIMA": 4, "FUNDACAO NACIONAL DE SAUDE": 1, "SERVICO FED. DE PROCESSAMENTO DE DADOS": 1, "UNIVERSIDADE FEDERAL DE MINAS GERAIS": 1, "COMPANHIA NACIONAL DE ABASTECIMENTO": 1, "COMISSAO NACIONAL DE ENERGIA NUCLEAR": 1, "UNIVERSIDADE FEDERAL DE ALAGOAS": 1, "COMANDO DA AERONAUTICA": 1, "FUNDACAO UNIVERSIDADE
You can’t perform that action at this time.