Skip to content

Instantly share code, notes, and snippets.

View jflaflamme's full-sized avatar

Jean-Francois Laflamme jflaflamme

View GitHub Profile
@jflaflamme
jflaflamme / whoisfix.sh
Last active November 8, 2018 03:29
Because when we CTRL+L & CTRL+C in Chrome to get an URL/domain to use Whois, we need to strip the http or https:// at the beginning. This override normal whois to accept http and https, strip that and pass it to normal whois function. Simply add to .bashrc
whois(){ /usr/bin/whois `echo $1|cut -d'/' -f3` }
@jflaflamme
jflaflamme / whoisfix.sh
Created November 8, 2018 02:17
Because when we CTRL+L & CTRL+C in Chrome to get an URL/domain to use Whois, we need to strip the http or https:// at the beginning.Override normal whois to accept http and https, strip that and pass it to normal whois function.
whois(){ /usr/bin/whois `echo $1|awk -F[/:] '{print $4}'` }
@jflaflamme
jflaflamme / whoisfix.sh
Created November 8, 2018 02:17
Because when we CTRL+L & CTRL+C in Chrome to get an URL/domain to use Whois, we need to strip the http or https:// at the beginning.Override normal whois to accept http and https, strip that and pass it to normal whois function.
whois(){ /usr/bin/whois `echo $1|awk -F[/:] '{print $4}'` }
@jflaflamme
jflaflamme / whoisfix.sh
Created November 8, 2018 02:17
Because when we CTRL+L & CTRL+C in Chrome to get an URL/domain to use Whois, we need to strip the http or https:// at the beginning.Override normal whois to accept http and https, strip that and pass it to normal whois function.
whois(){ /usr/bin/whois `echo $1|awk -F[/:] '{print $4}'` }
@jflaflamme
jflaflamme / whoisfix.sh
Created November 8, 2018 02:17
Because when we CTRL+L & CTRL+C in Chrome to get an URL/domain to use Whois, we need to strip the http or https:// at the beginning.Override normal whois to accept http and https, strip that and pass it to normal whois function.
whois(){ /usr/bin/whois `echo $1|awk -F[/:] '{print $4}'` }
@jflaflamme
jflaflamme / functions.php
Created November 28, 2017 09:29
wordpress use get_canonical_url to help a domain transition when both domains are active (SEO)
/* Use get_canonical_url to help a domain transition when both domains are active (SEO) and avoiding penality
* apply this on old domain and specify new domain
* Jeff Laflamme <jeff@geekho.asia>
*/
add_filter( 'get_canonical_url', 'geekho_get_canonical_url' );
function geekho_get_canonical_url( $canonical_url ) {
return preg_replace('/oldsite\.com/','newsite.com', $canonical_url);
}
@jflaflamme
jflaflamme / getEC2_iprange.sh
Last active September 5, 2017 04:01
Get AWS IP ranges (like EC2) (requires jq utility)
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json| \
jq '.prefixes[] | select(.region == "ap-southeast-1")| select(.service == "EC2").ip_prefix'
@jflaflamme
jflaflamme / gist:2a1ffc372cab37bb7fc38f4b7a573581
Created June 15, 2017 09:33
create postgresql database in running docker container
docker exec postgres9 psql -U postgres -c 'create database <database name>;'
@jflaflamme
jflaflamme / postgresql_export.sh
Created June 15, 2017 09:24
dump a postgresql backup from a running docker container
docker exec -it postgres9 pg_dump -Upostgres > backup.sql
@jflaflamme
jflaflamme / postgresql_import.sh
Created June 15, 2017 09:23
Import a dump into a docker postgresql instance (interactive -i)
docker exec -i postgres9 psql -U postgres < backup.sql