Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block jadedgnome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9005569

Virtualenv's bin/activate is Doing It Wrong

I'm a Python programmer and frequently work with the excellent [virtualenv][] tool by Ian Bicking.

Virtualenv is a great tool on the whole but there is one glaring problem: the activate script that virtualenv provides as a convenience to enable its functionality requires you to source it with your shell to invoke it. The activate script sets some environment variables in your current environment and defines for you a deactivate shell function which will (attempt to) help you to undo those changes later.

This pattern is abhorrently wrong and un-unix-y. activate should instead do what ssh-agent does, and launch a sub-shell or sub-command with a modified environment.


View dl
# dl
# USAGE: ./ <URL>
curl -s $URL |grep -o '<img src=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/<img src=["'"'"']//' -e 's/["'"'"']$//' |grep .cdn | xargs curl --retry 3 -O -J
View gifboom-dl
# USAGE: ./ <URL>
curl -s $URL |grep -o 'data-video-url=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/data-video-url=["'"'"']//' -e 's/["'"'"']$//' |cut -d '"' -f 2 | xargs wget
jadedgnome / feh bashrc bash function
Last active Aug 29, 2015
feh bash function/alias , It will search current dir and subfolders for .jpg,.jpeg & .png files and write them to a file in /tmp/ (e.g /tmp/filelist-4Gf) the last 3 characters are random. feh will then load the filelist and sort the files by modified time, display filename, auto-zoom and 800x600 resolution.
View feh bashrc bash function
fehl() {
randomfile=filelist-$(< /dev/urandom tr -dc A-Za-z0-9 |head -c 3).txt
find . -type f \( -iname "*.jpg*" -or -iname "*.jpeg*" -or -iname "*.png*" \) -printf "%p\n" | grep -v /thumbs/ >> /tmp/$randomfile ; feh -d -S mtime -Z -g 800x600 -f /tmp/$randomfile &
View show imgur album links
jadedgnome / list sshfs mounts bash function
Created Jul 13, 2014
list sshfs mounts from 'ps aux' output , formatted with awk.
View list sshfs mounts bash function
lsshfs() {
#list sshfs mounts
ps aux | grep sshfs | grep @ | grep -v "\-p" |awk '{print $2" = "$12" = "$13}'
ps aux | grep sshfs | grep @ | grep "\-p" | awk '{print $2" = "$12" "$13" "$14" = "$15}'
#list sshfs mounts
ps aux | grep sshfs | grep @ | grep -v "\-p" |awk '{print $2" = "$12" = "$13}'
ps aux | grep sshfs | grep @ | grep "\-p" | awk '{print $2" = "$12" "$13" "$14" = "$15}'
View containerhelper
#This is free and unencumbered software released into the public domain.
#Because this script needs root to do some things, excessive amounts of
#checking have been done to terminate the script if anything fails.
#Read all instructions very carefully. When it asks to type "yes", it must be
#all uppercase or it will fail.
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
View retry bash function
local delay=1 n
if ! [[ $1 = *[^0-9]* ]]; then
if (($1 > 0)); then
You can’t perform that action at this time.