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 | |
set -euo pipefail | |
IFS=$'\n\t' | |
set -x | |
DEVICE_B="/dev/xvdb" | |
DEVICE_C="/dev/xvdc" | |
VG_NAME="ephemeral" | |
LV_NAME="ephemeral" | |
DEVICE_LV="/dev/$VG_NAME/$LV_NAME" |
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 base class for implementing CLI scripts. | |
# ARGV and in/out IO's are injected, so can be mocked & tested. | |
# Basic signal handling by calling exit_on_signals inside work loops etc. | |
# Requires Ruby 2.0.0+ for keyword args etc. | |
class BaseScript | |
EXIT_SUCCESS = 0 | |
INDENT = " " | |
def initialize(argv, stdin: $stdin, stdout: $stdout, stderr: $stderr) |
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 -e | |
# Push local changes on the current branch as a new branch, then | |
# reset the local branch back to its remote tracking branch. | |
# | |
# This enables a fast workflow: | |
# 10 `git commit` one or more changes to main. | |
# 20 `git push-as -p new-feature` | |
# 30 goto 10 |
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 | |
# Initialize MySQL database. | |
# ADD this file into the container via Dockerfile. | |
# Assuming you specify a VOLUME ["/var/lib/mysql"] or `-v /var/lib/mysql` on the `docker run` command… | |
# Once built, do e.g. `docker run your_image /path/to/docker-mysql-initialize.sh` | |
# Again, make sure MySQL is persisting data outside the container for this to have any effect. | |
set -e | |
set -x |
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 | |
A=("$@") | |
X="$@" | |
echo; echo '"$@": <-- correct' | |
for arg in "$@"; do echo "$arg"; done | |
echo; echo '"${A[@]}": <-- correct' | |
for arg in "${A[@]}"; do echo "$arg"; done |
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 | |
# Example: ./getopts.sh -b world -a hello one two three | |
# Output: A=hello B=world 1=one 2=two 3=three 4= | |
while getopts "a:b:" opt; do | |
case "$opt" in | |
"a") A="$OPTARG";; | |
"b") B="$OPTARG";; | |
esac |
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
bitlbee | |
emacs | |
finch | |
freediameter | |
glib-networking | |
gnu-smalltalk | |
gst-plugins-bad | |
gwenhywfar | |
hamsterdb | |
inspircd |
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
# Please make this file available to others | |
# by sending it to <lirc@bartelmus.de> | |
# | |
# this config file was automatically generated | |
# using lirc-0.9.0-pre1(default) on Sat Dec 7 19:14:59 2013 | |
# | |
# contributed by | |
# | |
# brand: lirc-pda.conf | |
# model no. of remote control: |
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
name = ->(i){ "method_#{i}" } | |
methods = 10.times.map do |i| | |
define_method(name[i]) do | |
if i == 0 | |
raise "Top level error from #{name[i]}" | |
else | |
begin | |
send name[i - 1] | |
rescue | |
raise "Error from rescue in #{name[i]}" |
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
#!/usr/bin/env zsh | |
# Migrate data between Heroku Postgres databases via pgbackups. | |
# This involves downtime via `heroku maintenance:on`. | |
# | |
# To migrate example-app to HEROKU_POSTGRESQL_COLOR: | |
# heroku-postgres-migrate.sh <example-app> <HEROKU_POSTGRESQL_COLOR> | |
# | |
# To exit maintenance mode (in case something dies half-way): | |
# heroku-postgres-migrate.sh --wake |