Skip to content

Instantly share code, notes, and snippets.

@toritori0318
toritori0318 / userdata
Created February 7, 2014 07:39
userdataでmount
#!/bin/bash -ex
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
while [ ! -e /dev/sdb ]; do echo Waiting for Ephemeral Disk to attach; sleep 5; done
if ! `df | grep -q /media/ephemeral0` ; then
mkfs.ext3 /dev/sdb
mount -t ext3 /dev/sdb /media/ephemeral0
fi
# snip...
@sorah
sorah / relink.sh
Last active August 29, 2015 13:57
homebrew: link missing LinkedKegs again
@kamipo
kamipo / server_id
Created February 11, 2015 04:07
MySQLとか(Tokyo|Kyoto)ナントカのserver_idを計算するために使ってたコマンド
#!/usr/bin/perl -l
use strict;
use warnings;
$ENV{LANG} = "C";
$ENV{PATH} ||= "/usr/local/bin:/usr/bin/:/bin";
my $eth = shift || "eth0";
`ip addr list dev $eth|grep 'inet '` =~ m{\.(\d+?)\.(\d+?)\/};
@joemiller
joemiller / conf.d-graphite_test1.json
Created December 17, 2011 21:24
files for graphite handler testing in sensu
{
"checks": {
"graphite_test1": {
"type": "metric",
"command": "/etc/sensu/plugins/graphite_test1.rb",
"subscribers": [ "role_sensu_server" ],
"interval": 10,
"handlers": ["graphite"]
}
}
@hirose31
hirose31 / gist:1891020
Created February 23, 2012 06:15
daemontools詰め合わせ
### helper shell function
daemonup() {
[ -z "$1" ] && return
case $1 in
*/*)
DAEMONDIR=$1
;;
*)
if [ -d "$SYS_HOME" ]; then
@kenjiskywalker
kenjiskywalker / yes_or_no.pl
Created May 17, 2012 08:49
Perl while yes or no
#!/usr/bin/env perl
use strict;
use warnings;
my $file = './test.txt';
if ( -e $file ) {
print "allow overrite ok ? [y/n] : ";
FROM yoku0825/cent66:init
RUN echo "NETWORKING=yes" > /etc/sysconfig/network
RUN yum install -y which
RUN rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
RUN rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
RUN yum install -y mysql-community-mroonga groonga-tokenizer-mecab
RUN service mysqld start && mysql -e "GRANT ALL ON *.* TO root@'%' WITH GRANT OPTION"
EXPOSE 3306
@mala
mala / gist:3788589
Created September 26, 2012 15:07
hostsファイルにloopbackアドレス書くのは危険か、の話
9/25にGoogle+に書いたものの転載、脅威の度合いは各々判断してください
----
補足
DNS Rebinding対策として、DNSキャッシュサーバーがプライベートアドレスを返さないようにフィルタしている、というのは
http://labs.cybozu.co.jp/blog/kazuho/archives/2007/11/djbdns_and_anti-dns_pinning.php で書かれているような対策のこと
要点は
1.別途DNSリバインディング対策をしている場合に、その穴を自分で復活させてしまうことになる
@cho45
cho45 / aultebytes.pl
Created October 19, 2012 02:02
au lte recent usage
#!perl
use utf8;
use strict;
use warnings;
use WWW::Mechanize;
use Encode;
use Config::Pit;
use HTML::TreeBuilder::XPath;
@diceken
diceken / fio_summarize.pl
Created October 30, 2012 12:05 — forked from sh2/fio_summarize.pl
fio test/summarize script
#!/usr/bin/perl
use strict;
use warnings;
my (%sequential, %random);
my ($type, $blocksize, $ratio, $iodepth, $header);
while (my $line = <STDIN>) {