Skip to content

Instantly share code, notes, and snippets.

@sohooo
sohooo / .gitignore
Created June 30, 2012 10:38
rotating rsync backup
*.txt
@sohooo
sohooo / ramdisk.sh
Created June 30, 2012 13:25
create RAM disk in OS X
#!/bin/bash
#
# Create a RAM Disk in Mac OS X 10.5, 10.6, 10.7 or later.
# To remove the RAM disk, simply eject it from the desktop
# as you would any other disk.
#
# http://osxdaily.com/2007/03/23/create-a-ram-disk-in-mac-os-x/
if [ -z "$1" ]; then
echo Usage: $0 SIZE_IN_MB
@sohooo
sohooo / settings
Created July 29, 2012 14:30
OSX defaults setttings
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "MathBook Pro"
scutil --set HostName "MathBook Pro"
scutil --set LocalHostName "MathBook-Pro"
@sohooo
sohooo / gist:3267112
Created August 5, 2012 20:59 — forked from g3d/gist:2709563
Clean Install – Mountain Lion OS X 10.8 DP3
@sohooo
sohooo / postprocess.rb
Created January 18, 2014 16:54
The Sickbeard API[1] offers no interface to trigger the post-processing of downloaded episodes. This simple script uses Mechanize in order to start the process via the web app. [1] http://sickbeard.com/api/
require "rubygems"
require "mechanize"
site = 'http://pi:9094/home/postprocess/'
user = 'xbian'
pass = 'raspberry'
downloads = '/home/xbian/downloads/tv'
agent = Mechanize.new
@sohooo
sohooo / dbbackup.sh
Last active May 23, 2021 06:17
Simple script to create a backup of your Wordpress database. It uses the credentials from your wp-config.php and mysqldump's the data to wp-content/backups. Place it next to your wp-config.php and adjust $KEEP_DAYS.
#!/bin/bash
# fail on error
set -e
pushd `dirname $0` > /dev/null
SCRIPT=`pwd -P`
popd > /dev/null
KEEP_DAYS=150

Clone & Build

curl https://gist.github.com/raw/970438/caff9a09ed2d223b1123a69ede17cb19ad352af9/build.sh | sh
@sohooo
sohooo / jailuser.pp
Last active August 29, 2015 14:01
Creating jailed users based on my jailkit module; interfacing with common::shelluser.
common::jailuser { 'nova':
sections => ['jk_lsh', 'basicshell'],
binds => ['/var/log => log', '/opt => opt'],
keys => ['funky', 'george'],
}
define common::jailuser(
$user = $title,
$sections = [],
@sohooo
sohooo / plugin.js
Last active August 29, 2015 14:11
jQuery plugin template
// Protect the '$' alias and add scope by putting everything in
// an Immediately Invoked Function Expression:
// http://stage.learn.jquery.com/javascript-101/functions/#immediately-invoked-function-expression-iife
(function($) {
// As $.fn is just an alias for $.prototype, all jQuery
// objects ($ constructor) get our function.
$.fn.helloWorld = function(options) {
debug(this);
@sohooo
sohooo / Network.swift
Last active August 29, 2015 14:27 — forked from jbergen/Network.swift
Networker made from enums
/**
paste this code into a playground to test it out
*/
import Foundation
/**