Skip to content

Instantly share code, notes, and snippets.

View fabiofdsantos's full-sized avatar

Fábio Santos fabiofdsantos

View GitHub Profile
@fabiofdsantos
fabiofdsantos / reload-iptables-if.sh
Last active April 25, 2016 12:54 — forked from Khoulaiz/check_dyn_hostname
Reload iptables if... (e.g. ip was changed)
#!/bin/bash
# Reload iptables if... (e.g. ip was changed)
# Dependencies: dig (apt-get install dnsutils in debian/ubuntu)
# Note: Run "touch ~/current_ip" and add a new cron job with cmd "crontab -e" to run this script periodically.
HOSTNAME=<hostname-to-check.dyndns.org>
LOGFILE=~/current_ip
Current_IP=$(dig +short $HOSTNAME)
@fabiofdsantos
fabiofdsantos / angularJS_removeAccents.js
Last active February 2, 2018 17:26
An angularJS function to remove accents from an input string.
function removeAccents (str) {
map = {
'a' : 'á|à|ã|â|À|Á|Ã|Â',
'e' : 'é|è|ê|É|È|Ê',
'i' : 'í|ì|î',
'o' : 'ó|ò|ô|õ|Ó|Ò|Ô|Õ',
'u' : 'ú|ù|û|ü|Ú|Ù|Û|Ü',
'c' : 'ç|Ç',
'n' : 'ñ|Ñ'
};
@fabiofdsantos
fabiofdsantos / atom-editor-auto-update
Last active September 26, 2015 16:34
How to update Atom Editor on Linux
#!/bin/bash
wget -q https://github.com/atom/atom/releases/latest -O /tmp/latest
wget --progress=bar -q $(awk -F '[<>]' '/href=".*atom-amd64.deb/ {match($0,"href=\"(.*.deb)\"",a); print "https://github.com/" a[1]} ' /tmp/latest) -O /tmp/atom-amd64.deb --show-progress
dpkg -i /tmp/atom-amd64.deb
@fabiofdsantos
fabiofdsantos / modes-example.ggo
Created February 19, 2015 00:33
An example of use of the Gengetopt
package "modes-example"
version "1.0"
purpose "modes-example"
description "An example of use of the Gengetopt."
########################################################################
section "Decompression modes"
########################################################################
#-- DEF MODES ----------------------------------------------------------