Skip to content

Instantly share code, notes, and snippets.

@yaegashi
yaegashi / setup-redmine.sh
Created November 12, 2012 12:36
Set up a redmine instance with sub-uri: http://localhost:8080/redmine
#!/bin/sh -x
export RAILS_ENV=production
export REDMINE_LANG=ja
git clone https://github.com/redmine/redmine
cd redmine
rm config.ru
echo 'gem "unicorn"' >Gemfile.local
cat <<EOF >config/database.yml
$RAILS_ENV:
adapter: sqlite3
@yaegashi
yaegashi / monitrc
Created July 13, 2012 01:11
Minimal monit config example
# /etc/monit/monitrc
set daemon 60
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set eventqueue basedir /var/lib/monit/events slots 100
set mailserver mail.example.com
set alert monit@example.com
set httpd port 2812 and use address localhost allow localhost
include /etc/monit/conf.d/*
@yaegashi
yaegashi / gist:2361136
Created April 11, 2012 18:22
Git pre-commit hook script to verify file encodings.
#!/usr/bin/env perl
# Git pre-commit hook script to verify file encodings.
# Works with Perl 5.8. The bundled perl in msysgit is also supported.
# Copyright (C) 2012 Takeshi Yaegashi
# Encodings allowed to be committed.
my @allowed = qw/ascii utf8/;
# Encodings possible to be seen - optional.
@yaegashi
yaegashi / card.sh
Last active August 29, 2015 14:23
Card hand generator & matcher http://unix.stackexchange.com/a/211717/116972
#!/bin/bash
# This version conforms to Bash 3.2.53 on OS X.
stab=('\e[0;31;47m ♦' '\e[0;31;47m ♥' '\e[0;30;47m ♠' '\e[0;30;47m ♣')
ntab=(2 3 4 5 6 7 8 9 10 J Q K A)
match() {
for i; do
printf " ${stab[$((i/13))]}${ntab[$((i%13))]}\e[0m"
#!/bin/sh
set -e
if test $# -lt 2; then
echo "Usage: $0 <common name> <output> [<start> <end>]" >&2
exit 1
fi
cn=$1
@yaegashi
yaegashi / hosts
Last active August 29, 2015 14:05
https://github.com/ansible/ansible/issues/8633 test case on a role with only library modules
# /hosts
localhost ansible_connection=local