Skip to content

Instantly share code, notes, and snippets.

View fabiofdsantos's full-sized avatar

Fábio Santos fabiofdsantos

View GitHub Profile
@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 ----------------------------------------------------------
@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 / 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 / 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 / PrestaShop1.7-Nginx.conf
Created March 3, 2018 20:04
Nginx configuration for PrestaShop 1.7 (ready for CloudFlare usage)
# Replace _WEBSITE.COM_ with YOUR_DOMAIN.TLD
# Replace _ADMIN_FOLDER_ with YOUR_ADMIN_FOLDER
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name 127.0.0.1 _WEBSITE.com_ www._WEBSITE.com_;
@fabiofdsantos
fabiofdsantos / install-php-on-windows.md
Created March 8, 2018 11:23
How to install PHP on Windows

How to install PHP on Windows

  1. Download PHP binaries: https://windows.php.net/download/
  2. Extract .zip to C:\php
  3. Rename C:\php\php.ini-production to php.ini
  4. On php.ini, find extension_dir and change the existing value to "C:\php\ext"
  5. On php.ini, enable the needed extensions. E.g. extension=php_curl.dll
  6. Edit the system environment variables by editing system variable Path and add C:\php
@fabiofdsantos
fabiofdsantos / git_cmd_to_count_lines_changed.txt
Last active April 3, 2018 10:01
[Git] Count lines changed on multiple commits by a certain author
git log --author="Fábio Santos" --oneline --shortstat --after="2017-01-01" | grep -E " files? changed,"
@fabiofdsantos
fabiofdsantos / .bowerrc
Last active August 10, 2018 08:52
[Integration] Install AdminLTE in Laravel 5.6
{
"directory": "./resources/assets/vendor"
}
@fabiofdsantos
fabiofdsantos / rules.v4
Created November 4, 2018 21:35
Basic iptables to allow http, https and ssh
# Generated by iptables-save v1.4.21 on Mon Apr 25 12:53:52 2016
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp -s hostname.com --dport 22 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
@fabiofdsantos
fabiofdsantos / install-nodejs-npm-ubuntu.md
Created September 27, 2019 14:05
How to install nodejs & npm in Ubuntu

How to install nodejs & npm in Ubuntu

Avoid any system permissions issue :-)

curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh -o install_nvm.sh
bash install_nvm.sh
source ~/.profile
nvm install 10.16.3
nvm use 10.16.3