Skip to content

Instantly share code, notes, and snippets.

datagrok / gist:2199506
Last active Sep 22, 2020
Virtualenv's `bin/activate` is Doing It Wrong
View gist:2199506
riceo /
Created Apr 16, 2012
Dynamic DNS with Cloudflare - Python Script
# Set up a new A record in Cloudflare, add the details of it along with your account details below
# Make sure this script runs on startup (or whenever you get a new IP...)
# @author Aaron Rice <>
import urllib
import json
rbrooks /
Created May 17, 2012
Bandwidth Shape (Throttle) a Network Interface
# tc uses the following units when passed as a parameter.
# kbps: Kilobytes per second
# mbps: Megabytes per second
# kbit: Kilobits per second
# mbit: Megabits per second
# bps: Bytes per second
# Amounts of data can be specified in:
# kb or k: Kilobytes
J2R5M3 /
Created Jun 27, 2012
Reddit bash script
function RedditDir {
if [ -d ~/reddit ]
cd ~/reddit
mkdir ~/reddit
cd ~/reddit
ChickenProp / gist:3037292
Created Jul 3, 2012
Connecting my Raspberry Pi to the internet via my laptop
View gist:3037292

After installing Arch on my Raspberry Pi, internet worked out of the box: I could plug it into the router, turn it on, ssh in and start downloading things. But the router is in my housemate's bedroom, which isn't ideal. If I want the Pi to be connected to the internet in my room, I need it to be connected to my laptop. (Another option would be a USB wifi dongle, of course.) This is how I did it. Much credit goes to the Ubuntu wiki's Connection sharing page.

I should disclaim that I don't fully understand networking stuff, and some of what I say might be wrong. I also didn't write this as I was going; so while I've consulted my browser and shell histories, it's possible I've forgotten some steps.

My laptop is running Gentoo, and this is where most of the work has to be done. It connects to the internet through wifi, on interface wlan0. The ethernet port is eth0, and eth0 is also the name of the ethernet port on the Pi.

Step zero: plug ev

ryin /
Last active Jan 14, 2021
bash script for installing tmux without root access
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
cowboy /
Created Jul 15, 2012
Bash: Sudo keep-alive (good for long-running scripts that need sudo internally but shouldn't be run with sudo)
# Might as well ask for password up-front, right?
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Example: do stuff over the next 30+ mins that requires sudo here or there.
function wait() {
faleev / gist:3435377
Created Aug 23, 2012
Compile FFmpeg on Ubuntu
View gist:3435377

Compile FFmpeg on Ubuntu

This guide supports Ubuntu Precise Pangolin 12.04, Ubuntu Oneiric Ocelot 11.10, Ubuntu Natty Narwhal 11.04, and Ubuntu Maverick Meerkat 10.10. Separate guides are available for Ubuntu Lucid Lynx 10.04 and Ubuntu Hardy Heron 8.04. This guide will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide](

lynus / wan_ssh
Created Aug 24, 2012
openwrt:allow wan ssh into your wrt
View wan_ssh
by default,openwrt do not allow ssh access from wan, here are two method to change that:
1.login into your wrt from a lan host.issue the following command:
iptables -F
the command "flush away" all the firewall rules,including the one that rejects ssh request from wan.
now you can try ssh from anywhere.
aware that the firewall deactivation leads to highly security risk.and after the wrt restarts ,all default firewall configuration comes hava to "flush" the rules once again.
andreychernih / gist:3583565
Created Sep 1, 2012
Setup VPN server with WAN forwarding in 5 minutes
View gist:3583565
apt-get -y install pptpd dnsmasq
Add/uncomment the following line in /etc/sysctl.conf:
Commit the changes by running as root:
sysctl -p
You can’t perform that action at this time.