Instantly share code, notes, and snippets.

# reference:
echo "Adding default route to $route_vpn_gateway with /0 mask..."
ip route add default via $route_vpn_gateway
echo "Removing /1 routes..."
ip route del via $route_vpn_gateway
ip route del via $route_vpn_gateway


Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

# Reference:
import paramiko
# Open a transport
host = ""
port = 22
transport = paramiko.Transport((host, port))
# @author Adriano Rosa (
# @date: 2014-05-13 09:43
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
# USAGE: this command will ask for the certificate name and number in days it will expire
# Bash shell script for generating self-signed certs. Run this in a folder, as it
# generates a few files. Large portions of this script were taken from the
# following artcile:
# Additional alterations by: Brad Landers
# Date: 2012-01-27
"""Python script to create a histogram of words in a text file.
Usage: python -f "/path/to/file.txt" -n 200
Specify the path to the text file as above. Manually specify the top N words to report (default 100).
Text file can contain punctuation, new lines, etc., but special characters aren't handled well.
View meghan_movie.txt
Creating model...
Restoring weights...
Human: What is your perfect day?
Alice: I don't know what you're talking about.
Human: If you could have been born into a different time in history, what would you choose?
Alice: He'd been seeing each other.
Human: How do you want to be remembered?
View GPUs.txt
0x1000:0x0001::0:[GPUs.txt file] Updated 20180327 -B
0x1002:0x0002:::[R9600 Pro] (Asus OEM for HP - Primary)
0x1002:0x0003:::[R9600 Pro] (Asus OEM for HP - Secondary)
0x1002:0x0004:::[Rage Fury Pro]
0x1002:0x000a:::[Radeon 7000]
0x1002:0x000b:::[Radeon 7000]
0x1002:0x000d:::[Radeon X1200]
0x1002:0x0014:::[Rage Fury Pro]
0x1002:0x001a:::[Radeon 7000]
0x1002:0x001c:::[Rage 128 Pro 4XL]
View 70-persistent-net.rules
# /etc/udev/rules.d/70-persistent-net.rules
# ln -sfn /dev/null /lib/udev/rules.d/80-net-setup-link.rules
# Ref:
# PCI device 0x10ec:0x8xxxx (ethernet_module_here)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="3x:17:ef:6f:s2:2h", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"