Skip to content

Instantly share code, notes, and snippets.

# Quickly delete all traces of a user from the database and filesystem
# usage: ./ username
USERID=`sqlite3 ../database.db "select id from users where username = '${USER}'"`
for table in albums comments images posts; do
sqlite3 ../database.db "delete from ${table} where userid = ${USERID}"
anonymous / hooks.rb
Created Feb 25, 2014
View hooks.rb
require 'nokogiri'
module Try
def try(method, args = [])
if self.respond_to? method
self.send method, *args
funkenstrahlen /
Last active Aug 29, 2015
A small script to convert all AVI files in a folder to mp4/h264
# A small script to convert all AVI files in a folder to mp4 h264
# You can either use HandbrakeCLI or ffmpeg.
# ffmpeg requires to be compiled with libx264 which is not default in debian based distributions
# To use HandbrakeCLI do not forget to install the packages!
# For Linux Mint I had to do the following to get HandbrakeCLI running:
# sudo add-apt-repository ppa:stebbins/handbrake-snapshots
# sudo apt-get update
stlehmann /
Created May 6, 2014
Execute a Python script from Python console
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.
echo "file name"
read name
#both the 'start' and 'end' variables should be time stamps of the format hh:mm:ss
echo "start of clip"
read start
echo "end of clip"
makefu / clbin
Last active Aug 29, 2015 — forked from GermainZ/clbin
updated clbin, supports images through pipe and images without extension
View clbin
#!/usr/bin/env bash
# Upload text/images to from the command line
# License: ISC
clip() {
if command -v xclip &> /dev/null; then
xclip -selection clip <<< "$@"
elif command -v xsel &> /dev/null; then
xsel -b -i <<< "$@"
florianbeer / hostup
Created Apr 20, 2015
Alert if host is back up
View hostup
hostup() {
if (( $# != 1 )); then
echo "Usage: hostup HOSTNAME"
until $(which ping) -W1 -c1 ${1} > /dev/null; do sleep 5; done && $(which say) "${1} is up"
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
View gist:1552606
#! /bin/bash
# # keepalive #
# Keeps your processes running - handy quick-restart for services.
# Run a server with: