Skip to content

Instantly share code, notes, and snippets.

@ckng
ckng / docker-pruner.sh
Last active February 23, 2025 15:56 — forked from fayak/docker-pruner.sh
Docker pruner. Deletes docker's overlay2 leftovers that survive 'docker system prune -af --volumes'
#!/usr/bin/env bash
set -eEuo pipefail
MARKER_FILE_NAME="${DOCKER_PRUNER_MARKER:-DOCKER-PRUNER-MARKER-FILE}"
DOCKER_PATH="${DOCKER_PATH:-/var/lib/docker/overlay2}"
function _used_dirs() {
for docker_obj in $(docker ps -aq) $(docker image ls -aq); do
lowerdir="$(docker inspect "$docker_obj" | jq '.[].GraphDriver.Data.LowerDir' -r)"
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
acrobat
africa
alaska
albert
albino
album
alcohol
@ckng
ckng / gist:467b69cc8016de4a44846b47ef18859d
Created June 9, 2017 07:15 — forked from reidransom/gist:6042016
Auto-starting VirtualBox VMs on OS X

Auto-starting VirtualBox VMs on OS X

After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

Link to original article.

Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

sudo cp \

/Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \

@ckng
ckng / seed_derivatives.drush.inc
Created August 26, 2016 14:18 — forked from typhonius/seed_derivatives.drush.inc
This script can generate image derivatives for Drupal for warming up the filesystem prior to going live. Image derivative generation puts an amount of load on the servers so it images have been migrated from another server with no derivatives, it may be useful to pre-generate using this script.
<?php
/**
* Implements hook_drush_command().
*/
function seed_derivatives_drush_command() {
$items = array();
$items['seed_derivatives'] = array(
'description' => "Create image derivatives",
@ckng
ckng / ubuntu-configure-sendmail-with-gmail
Created August 10, 2016 23:40 — forked from sshtmc/ubuntu-configure-sendmail-with-gmail
Ubuntu sendmail using smtp.gmail.com
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
@ckng
ckng / flexbox.less
Last active August 29, 2015 14:20 — forked from wzr1337/flexbox.less
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
.old-flex-display(@display);
display: ~"-webkit-@{display}";
# Fail2Ban configuration file
#
# Author: Charles Chou
# Modified: Norman Yee
# fix original cloudflare-blacklist.conf
# $Revision$
#
[Definition]
#! /bin/bash
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start memcached daemon
@ckng
ckng / rename-db.sh
Created August 9, 2012 07:38 — forked from michaelmior/rename-db.sh
MySQL rename database. Simple script to move all tables from one database to another. Also, RENAME table doesn't work on views, so they won't be migrated.
#!/bin/bash
OLD_DB=$1
NEW_DB=$2
USER=root
read -s -p "MySQL $USER Password: " PASS
echo "CREATE DATABASE $2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;" | mysql -u $USER --password=$PASS
TABLES=`echo "SHOW TABLES IN $1;" | mysql -NB -u $USER --password=$PASS`