Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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