Skip to content

Instantly share code, notes, and snippets.

View lucaswilric's full-sized avatar

Lucas Wilson-Richter lucaswilric

View GitHub Profile
@lucaswilric
lucaswilric / db_backup.sh
Created November 24, 2012 12:08
Back up, compress and encrypt a small MySQL or PostgreSQL database.
#!/bin/bash
# This script dumps a database to SQL, compresses, encrypts and timestamps it, then saves it to Dropbox. Ideal for a cronjob.
# It uses symmetric encryption, so guard your password carefully.
#
# NOT RECOMMENDED FOR LARGE DATABASES!
# Dump a MySQL database
# Read this for how to get your password into mysqldump:
# https://dev.mysql.com/doc/refman/5.1/en/password-security-user.html
mysqldump -u username > database.sql
@lucaswilric
lucaswilric / config.xml
Created November 2, 2013 02:42
MediaTomb config & import script
<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd"><!--
Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
information on creating and using config.xml configration files.
-->
<server>
<ui enabled="yes" show-tooltips="yes">
<accounts enabled="no" session-timeout="30">
<account user="mediatomb" password="mediatomb"/>
</accounts>
@lucaswilric
lucaswilric / amplify_all.rb
Created May 21, 2014 08:20
Use SoX to amplify all WAV files in the current directory as much as possible without clipping
#!/usr/bin/env ruby
# PVC: Easy as shell pipes
# https://rubygems.org/gems/pvc
require 'pvc'
# SoX: Sound eXchange
# http://sox.sourceforge.net/
destination_dir = 'amplified'
# -*- coding: utf-8 -*-
from datetime import datetime
import time
import sublime_plugin
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD`, `now`, `datetime`, `utcnow`, `utcdatetime`,
`date` and `time`
@lucaswilric
lucaswilric / kite.rb
Last active April 16, 2019 06:22
Open Buildkite for the current repo and branch
#!/usr/bin/env ruby
# Open Buildkite builds for the current repo and branch
# Tested on OSX 10.10.5
repo = `git info | grep remote.origin.url | sed -nE 's/.*github\.com[\:\/](.*)\.git/\\1/p'`.chomp
buildkite_slug = repo.gsub('_', '-')
branch = ARGV.length > 0 ? ARGV[0] : `git rev-parse --abbrev-ref HEAD`.chomp
`open https://buildkite.com/#{buildkite_slug}/builds?branch=#{branch}`
def hello_world
puts 'Hello, World!'
end
hello_world
@lucaswilric
lucaswilric / apt-diff.sh
Created February 1, 2019 05:47
apt-diff - Diff the installed apt packages between two versions of a Docker image
#!/bin/bash -e
repo=$1
tag1=$2
tag2=$3
get_pkgs () {
img=$1
file=$2
@lucaswilric
lucaswilric / basecamp-projects-sticky-header.user.js
Last active February 26, 2024 08:03 — forked from whispy/basecamp-projects-sticky-header.user.js
This script adds a new sticky header to Basecamp projects and todo lists on scroll.
// ==UserScript==
// @name Basecamp - Projects Sticky Header
// @namespace http://tampermonkey.net/
// @version 0.13
// @description This script adds a new sticky header to Basecamp projects and todo lists on scroll. Never forget where you are again!
// @updateURL https://gist.github.com/lucaswilric/75f9492fc64befed433e32b3013bc1ab/raw/basecamp-projects-sticky-header.user.js
// @downloadURL https://gist.github.com/lucaswilric/75f9492fc64befed433e32b3013bc1ab/raw/basecamp-projects-sticky-header.user.js
// @author Dan Berkowitz, Lucas Wilson-Richter
// @match https://3.basecamp.com/*
// @grant GM_addStyle