Skip to content

Instantly share code, notes, and snippets.

Rodrigo Fernandes rtfpessoa

View GitHub Profile
@rtfpessoa
rtfpessoa / handle-ctrl-c.py
Created Mar 19, 2016
Handle CTRL+C in Python
View handle-ctrl-c.py
#!/usr/bin/env python
import signal
import sys
def signal_handler(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
@rtfpessoa
rtfpessoa / lazy-load-nvm.sh
Created Aug 26, 2016
NVM lazy loading script
View lazy-load-nvm.sh
#!/bin/bash
#
# NVM lazy loading script
#
# NVM takes on average half of a second to load, which is more than whole prezto takes to load.
# This can be noticed when you open a new shell.
# To avoid this, we are creating placeholder function
# for nvm, node, and all the node packages previously installed in the system
# to only load nvm when it is needed.
@rtfpessoa
rtfpessoa / java-8-ami.md
Last active Apr 29, 2020
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami
View java-8-ami.md
@rtfpessoa
rtfpessoa / tvi-player-downloader.sh
Last active Apr 14, 2020
TVI Player Downloader
View tvi-player-downloader.sh
#!/usr/bin/env bash
for EPISODE_NUMBER in 1 2 3 4 5; do
EPISODE_URL="http://tviplayer.iol.pt/programa/pesadelo-na-cozinha/58bd77b50cf26a3bdcfca690/episodio/t1e${EPISODE_NUMBER}"
PLAYLISTS_BY_QUALITY_URLS=$(curl $EPISODE_URL 2>/dev/null | grep 'vod/_definst_' | sed -E 's/[ ]+videoUrl: '"'"'(.*)'"'"',/\1/')
youtube-dl -f best --audio-quality 0 -o pesadelo-na-cozinha-S01E0${EPISODE_NUMBER}.ts --prefer-ffmpeg $PLAYLISTS_BY_QUALITY_URLS &
done
wait
@rtfpessoa
rtfpessoa / agnoster.bash
Last active Mar 29, 2020
Agnoster Bash Theme
View agnoster.bash
#!/usr/bin/env bash
# vim: ft=bash ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for BASH
#
# (Converted from ZSH theme by Kenny Root)
# https://gist.github.com/kruton/8345450
#
# Updated & fixed by Erik Selberg erik@selberg.org 1/14/17
@rtfpessoa
rtfpessoa / getopts_long.sh
Created Jan 21, 2017
getopts_long -- POSIX shell getopts with GNU-style long option support
View getopts_long.sh
#!/usr/bin/env bash
#
# getopts_long -- POSIX shell getopts with GNU-style long option support
#
# Copyright 2005-2009 Stephane Chazelas <stephane_chazelas@yahoo.fr>
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that the above copyright notice appear in all copies and that both that
@rtfpessoa
rtfpessoa / openvpn-client-key-gen.sh
Last active Oct 25, 2019
OpenVPN Client Key Generator
View openvpn-client-key-gen.sh
#!/bin/bash
#
# OpenVPN Client Key Generation Script
#
# Author: rtfpessoa
# Date: 03-09-2016
#
# Based on the guide:
# * https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04
@rtfpessoa
rtfpessoa / .config
Last active Aug 11, 2019 — forked from sit/gitproxy-socat
Wrappers around socat and netcat to use git behind a proxy
View .config
# Use netcat to proxy git ssh through a proxy.
# Useful if you are trying to clone ssh:// from inside a company.
#
# Save this file as `~/.ssh/config`
#
# See http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ for Emil Sit's original HTTP proxy script.
# See http://www.jones.ec/blogs/a/entry/using_git_through_a_socks/ for updated SOCKS version.
#
ProxyCommand nc -x 10.0.0.84:1986 %h %p
@rtfpessoa
rtfpessoa / brew-cask-upgrade.sh
Created Sep 24, 2016 — forked from c00kiemon5ter/brew-cask-upgrade.sh
a portable shell script to upgrade cask packages
View brew-cask-upgrade.sh
#!/bin/sh
help=0
latest=0
verbose=0
status=0
usage() {
cat <<-EOF
${0##*/} [options]
@rtfpessoa
rtfpessoa / docker-uninstall.sh
Created Aug 29, 2015
Docker uninstall script
View docker-uninstall.sh
#!/bin/bash
# Uninstall Script
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi
while true; do
You can’t perform that action at this time.