Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Quickly delete all traces of a user from the database and filesystem
# usage: ./deluser.sh username
USER=$1
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}"
done
anonymous
anonymous / hooks.rb
Created February 25, 2014 22:42
require 'nokogiri'
module Try
def try(method, args = [])
if self.respond_to? method
self.send method, *args
end
end
end
@funkenstrahlen
funkenstrahlen / encode_to_mp4.sh
Last active August 29, 2015 13:56
A small script to convert all AVI files in a folder to mp4/h264
#!/bin/bash
#
# 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
stlehmann / exec_script.py
Created May 6, 2014 15:21
Execute a Python script from Python console
#Python2
execfile("./filename")
#Python3
exec(open("./filename").read())
anonymous
anonymous / containerhelper
Created May 29, 2014 10:38
#!/bin/bash
#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.
@mxbees
mxbees / get-teh-clip.sh
Created July 5, 2014 11:44
clip movies
#!/bin/bash
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
makefu / clbin
Last active August 29, 2015 14:04 — forked from GermainZ/clbin
updated clbin, supports images through pipe and images without extension
#!/usr/bin/env bash
# Upload text/images to clbin.com from the command line
# License: ISC http://www.isc.org/downloads/software-support-policy/isc-license/
clip() {
if command -v xclip &> /dev/null; then
xclip -selection clip <<< "$@"
elif command -v xsel &> /dev/null; then
xsel -b -i <<< "$@"
fi
}
@florianbeer
florianbeer / hostup
Created April 20, 2015 20:35
Alert if host is back up
hostup() {
if (( $# != 1 )); then
echo "Usage: hostup HOSTNAME"
else
until $(which ping) -W1 -c1 ${1} > /dev/null; do sleep 5; done && $(which say) "${1} is up"
fi
}
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
@bpo
bpo / gist:1552606
Created January 2, 2012 23:28
keepalive
#! /bin/bash
#
# # keepalive #
#
# Keeps your processes running - handy quick-restart for services.
#
# USAGE:
#
# Run a server with:
#