Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Moves torrents from the queue directory into the watch directory.
#
# Example usage:
# * manage_rtorrent_queue.sh movies 3
# * manage_rtorrent_queue.sh software 1
# Check for proper number of command line args.
EXPECTED_ARGS=2
# If an external monitor is connected, place it with xrandr
# External output may be "VGA" "VGA-0" "VGA1" or "DVI-0" or "TMDS-1"
EXTERNAL_OUTPUT="VGA1"
INTERNAL_OUTPUT="LVDS1"
# EXTERNAL_LOCATION may be one of: left, right, above, or below
EXTERNAL_LOCATION="right"
case "$EXTERNAL_LOCATION" in
left|LEFT)
import xmlrpclib, webbrowser
# EDIT: webfaction credentials
username = "USERNAME"
password = "PASSWORD"
# EDIT: email address domain (must exist in control panel)
mail_domain = "example.com"
# EDIT: domain on which you want to access gmail (must exist in control panel)
pcm.dsp0 {
type plug
slave.pcm "dmix"
# A hint is required for listing the device in some GUIs, e.g. Phonon configuration.
hint {
show on
description "My dmix dsp0"
}
}
# mixer0 can stay unchanged, because
@lionelyoung
lionelyoung / rtorrent.rc
Created December 6, 2014 07:10
rtorrent.rc
#!/bin/sh
#############
###<Notes>###
#############
# This script depends on screen.
# For the stop function to work, you must set an
# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.
# If you typically just start rtorrent with just "rtorrent" on the
# command line, all you need to change is the "user" option.
# Attach to the screen session as your user with
@lionelyoung
lionelyoung / server.py
Created April 22, 2015 16:48
Python server
#!/usr/bin/python
"""
Save this file as server.py
>>> python server.py 0.0.0.0 8001
serving on 0.0.0.0:8001
or simply
>>> python server.py
@lionelyoung
lionelyoung / generate_thumbnails.py
Created August 2, 2015 04:52
Generate thumbnails
#!/usr/bin/env python
# With the provided src and dest locations, will generate all the remaining
# thumbnails in the desired size. Use --force to regenerate
import argparse
from PIL import Image
import glob, os
def debug_display_files(files, debug_level=1):
files = list(files)
if args.debug >= 1:
@lionelyoung
lionelyoung / gist:409744
Created May 22, 2010 03:52
toggles between Dvorak input and us
#!/bin/bash
#setxkbmap -option grp:switch,grp:alts_toggle us,dvorak
setxkbmap -option grp:switch,grp:alt_shift_toggle us,dvorak
#* alt_shift_toggle
#* ctrl_shift_toggle
#* ctrls_toggle
@lionelyoung
lionelyoung / img2pdf.sh
Created May 22, 2010 03:58
Converts an image to PDF. Useful for making PDF images for use in Latex.
#!/bin/bash
if [ ! -f "$1" ] ; then
echo "Input file $1 doesn't exist"
exit 1
fi
TITLE=${1%%.*}
#echo $TITLE
mogrify -format eps $1 && epstopdf $TITLE.eps
#!/bin/bash
#put name of device here
MYMOUNTDIR=/mnt/location/here
PASSFILE=/home/yourname/passfile.kdb
DEVICEDIR=/dev/sdc1
if [ -b /dev/sdc ]; then
echo Mounting /dev/sdc
exo-mount -d $DEVICEDIR || exit 1