View latest_docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
sudo sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list" | |
sudo apt-get update -qq | |
sudo apt-get install -qqy lxc-docker |
View suspend_until
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Auto suspend and wake-up script | |
# | |
# Puts the computer to sleep and automatically wakes it up at specified time | |
# | |
# Written by Romke van der Meulen <romke.vd.meulen@gmail.com> | |
# | |
# Takes a 24-hour time HH:MM as its argument | |
# Example: |
View suspend_for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Auto suspend and wake-up script | |
# | |
# Puts the computer to sleep and automatically wakes it up after specified period | |
# | |
# Courtesy of http://ubuntuforums.org/member.php?u=130449 | |
# from thread http://ubuntuforums.org/showthread.php?t=938533&page=2 | |
# Edited by Romke van der Meulen <romke.vd.meulen@gmail.com> |
View Renderable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Every renderable can have template files in the directory matching its class. The matching directory | |
* follows the Zend naming convention, except lowercased to prevent conflicts between OSes. | |
* E.g. for class `ReqHandler_Home` the path to template "view" would be `reqhandler/home/view.tpl.php` | |
* This obeys inheritance: e.g. if class `ReqHandler_Home extends ReqHandler_Base` | |
* and template `reqhandler/base/view.tpl.php` exists, than that template is used by default, | |
* but can be overriden by `reqhandler/home/view.tpl.php` | |
* |
View up.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################### | |
# # | |
# Auto-update externals # | |
# # | |
# Will go into your workspace (~/workspace) # | |
# and `git pull` all projects listed in # | |
# .git-auto-pull, and will `svn up` all # | |
# projects listed in .svn-auto-up # |
View docker-mysqlroot.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use `mysqlroot` to go to interactive mysql shell, | |
# type e.g. `mysqlroot "SHOW DATABASES" to directly execute query | |
# or type `mysqlroot my-script.sql` to execute script | |
function mysqlroot() { | |
if [ $# -eq 0 ]; then | |
docker run -it --link mysql_mysql_1:mysql --rm mariadb sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' | |
else | |
if [ -f $1 ]; then | |
cat $1 | docker run -i --link mysql_mysql_1:mysql --rm mariadb sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"' | |
else |
View logrotate_dockerized_mysql_backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logrotate backup instructions for a Dockerized mysql server. | |
# This will automatically dump all your databases once a day | |
# and maintain a compressed one week backlog. | |
# Write this config to /etc/logrotate.d/mysql-backup | |
/var/backups/db.sql.gz { | |
daily | |
rotate 8 | |
nocompress | |
create 640 root adm | |
postrotate |
View smooth-anchors-scroll.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a').click(function(ev){ | |
href = this.href.replace(window.location.href,''); | |
if ( href[0] != '#' || !$(href) ) { | |
return; | |
} | |
$('html, body').animate({ scrollTop: $(href).offset().top }, 500); | |
ev.stopPropagation(); | |
return false; | |
}); |
View autowrap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.forEach.call(document.querySelectorAll("textarea.autowrap"), function(textarea) { | |
function wrap() { | |
var cursorPos = textarea.selectionStart; | |
var newValue = textarea.value.split("\n").map(function(line) { | |
var wrapped = ""; | |
while (line.length > textarea.cols) { | |
var wrapPos = line.lastIndexOf(" ", textarea.cols); | |
if (wrapPos === -1) { | |
wrapPos = textarea.cols; | |
} |
OlderNewer