Skip to content

Instantly share code, notes, and snippets.

View deluser.sh
#!/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 Feb 25, 2014
View hooks.rb
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 Aug 29, 2015
A small script to convert all AVI files in a folder to mp4/h264
View encode_to_mp4.sh
#!/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
Execute a Python script from Python console
View exec_script.py
#Python2
execfile("./filename")
#Python3
exec(open("./filename").read())
View containerhelper
#!/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.
View get-teh-clip.sh
#!/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 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 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 Apr 20, 2015
Alert if host is back up
View hostup
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
}
View where-my-site-packages.py
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.
#
# USAGE:
#
# Run a server with:
#
You can’t perform that action at this time.