Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
wifi_interface="$(nmcli d | awk '$2 ~ /wifi/ {print $1}')"
description="${1:-${wifi_interface}}"
sudo true
samples=10
sequences=($(seq 1 ${samples}))
.PHONY = all install reinstall uninstall test _wrapped_stow _pre_stow _stow _post_stow _stow_ignore _install_args _reinstall_args _uninstall_args _test_args
all:
$(error You probably want to run 'make test' first)
_stow_ignore:
$(foreach file,$(wildcard *),$(eval ARGS += --ignore=$(file)))
_stow: _stow_ignore
@stow -t $(HOME) -v $(ARGS) .
@mgor
mgor / dice-pwgen.sh
Last active July 4, 2016 11:30
diceware password generator (as secure as $RANDOM would be?)
#!/usr/bin/env bash
DICTIONARY="/tmp/diceware.lst"
DICTIONARY_URL="http://world.std.com/~reinhold/diceware.wordlist.asc"
WORDS="3"
COUNT="1"
SEPARATOR="-"
while getopts ":w:n:s:" optchar; do
case "${optchar}" in
w)
#!/usr/bin/env bash
commit_message=$1
commit_type=$2
commit_hash=$3
prefix="[commit prefix]"
heading=$(head -1 ${commit_message})
if [ -z "${heading}" ]
#!/usr/bin/env bash
cmd="mysql -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} ${MYSQL_DATABASE} -e"
table_prefix=$($cmd "show tables;" -N -B 2>/dev/null | tail -1 | awk -F\_ '{print $1}')
$cmd "update ${table_prefix}_options set option_value = 'http://localhost' where option_name in ('siteurl', 'home');" 2>/dev/null
.
├── env
│ ├── config
│ │ ├── 01production_dump.sql
│ │ ├── 02update-development-site.sh.sh
│ │ └── php.ini-development
│ └── dev-env.sh
└── src
└── wp-content
├── plugins
@mgor
mgor / dev-env.sh
Last active January 9, 2016 17:56
#!/usr/bin/env bash
DATABASE_CONTAINER="dev-db"
WEBSERVER_CONTAINER="dev-web"
MYSQL_ROOT_PASSWORD="my-secret"
MYSQL_USER="dev"
MYSQL_PASSWORD="dev"
MYSQL_DATABASE="wordpress"
docker pull wordpress:latest
docker pull mysql:${MYSQL_VERSION}
@mgor
mgor / pydmesg
Created May 4, 2015 11:46 — forked from saghul/pydmesg
#!/usr/bin/env python
# coding=utf8
# Copyright (C) 2010 Saúl ibarra Corretgé <saghul@gmail.com>
#
"""
pydmesg: dmesg with human-readable timestamps
"""