Skip to content

Instantly share code, notes, and snippets.

@diraol
diraol / profile_report_minimal_settings_bug_report.ipynb
Last active October 13, 2020 15:07
profile_report_minimal_settings_bug_report.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diraol
diraol / quick-slugify.sh
Last active February 17, 2019 13:46 — forked from oneohthree/quick-slugify.sh
Quick bash slugify
# 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 December 28, 2018 14:04
keybase certification

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 January 9, 2018 15:47
Create a nested python dict from a list of items to be splitted
# 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 September 9, 2017 19:41
Install Vim 8 with Python 3, Ruby and Lua support on Debian
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 February 15, 2021 11:34
Python code to parse PCAP files with openflow (1.0) messages
"""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 April 29, 2018 01:26
Mailman BanAll + Discard
// 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
Loading
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 June 15, 2016 18:05 — forked from cemsbr/multiple_exceptions.py
Throw multiple validation errors
# 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 August 29, 2015 14:02
Macro para Requisitos de Engenharia de Software em LaTeX
%%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