Skip to content

Instantly share code, notes, and snippets.

View hfm's full-sized avatar

Okumura Takahiro hfm

View GitHub Profile
@hfm
hfm / helloworld.pl
Created December 23, 2013 13:40
$ perl -MO=Bytecode,-S learning-perl/chap1/helloworld.pl
#!/usr/bin/perl
print "Hello World!\n";
@hfm
hfm / readme.md
Last active January 4, 2016 08:09

こんな感じのシェルスクリプトを書く

#!/bin/bash

ssh <user-id>@`basename $0`

$PATHのどこかにドメイン名でsymlinkを貼る

@hfm
hfm / gist:9483897
Created March 11, 2014 11:24
vagrant上でmysqlをバージョンごとに立ち上げてみた
vagrant 8744 0.0 0.1 5816 1452 pts/0 Ss 07:53 0:00 \_ -bash
vagrant 17202 0.0 0.1 6428 1072 pts/0 S 10:22 0:00 \_ /bin/sh bin/mysqld_safe
vagrant 17226 0.0 6.1 845140 64100 pts/0 Sl 10:22 0:00 | \_ /home/vagrant/mysql/4.0.30/libexec/mysqld --basedir=/home/vagrant/mysql/4.0.30 --datadir=/home/vagrant/mysql/4.0.30/var --pid-file=/home/vagrant/mysql/4.0.30/var/localhost.localdomain.pid --skip-locking --port=3306 --socket=/home/vagrant/mysql/4.0.30/var/lib/mysql/mysql.sock
vagrant 17245 0.0 0.1 6000 1076 pts/0 S 10:22 0:00 \_ /bin/sh bin/mysqld_safe
vagrant 17270 0.0 6.3 834224 66020 pts/0 Sl 10:22 0:00 | \_ /home/vagrant/mysql/4.1.25/libexec/mysqld --basedir=/home/vagrant/mysql/4.1.25 --datadir=/home/vagrant/mysql/4.1.25/var --pid-file=/home/vagrant/mysql/4.1.25/var/localhost.localdomain.pid --skip-external-locking --port=3307 --socket=/home/vagrant/mysql/4.1.25/var/lib/mysql/mysql.sock
vagrant 1
Scripts loaded:
* ia beep.pl 1.1 (Beep (terminal bell) and/or run command on highlight/private message or new DCC)
* ia buffers.pl 4.5 (Sidebar with list of buffers)
ia chanmon.pl 2.4 (Channel Monitor)
ia colorize_lines.pl 3.2 (colors text in chat area with according nick color, including highlights)
ia highmon.pl 2.4 (Highlight Monitor)
* ia iset.pl 3.4 (Interactive Set for configuration options)
ia autoconnect.py 0.2.3 (reopens servers and channels opened last time weechat closed)
ia go.py 1.9 (Quick jump to buffers)
ia grep.py 0.7.2 (Search in buffers and logs)

/root/.my.cnfに以下のように書くとlogrotateでもmysqladminが動きました。

[mysqladmin]
user     = root
password = hoge

コツとしては、 [mysqladmin] というグループを作ることにあるようです。

@hfm
hfm / gist:10014111
Last active August 29, 2015 13:58
--usage、見せる気無いだろ
[vagrant@passport001 ~]$ tar --usage
使用法: tar [-AcdrtuxGnSkUWOmpsMBiajJzZhPlRvwo?] [-g FILE] [-f ARCHIVE]
[-F NAME] [-L NUMBER] [-b BLOCKS] [-H FORMAT] [-V TEXT] [-I PROG]
[-C DIR] [-K MEMBER-NAME] [-N DATE-OR-FILE] [-T FILE] [-X FILE]
[--catenate] [--concatenate] [--create] [--diff] [--compare]
[--delete] [--append] [--list] [--test-label] [--update]
[--extract] [--get] [--check-device] [--listed-incremental=FILE]
[--incremental] [--ignore-failed-read] [--level=NUMBER] [--seek]
[--no-check-device] [--no-seek] [--occurrence[=NUMBER]]
[--sparse-version=MAJOR[.MINOR]] [--sparse] [--keep-old-files]
#!/bin/bash
set -ue
usage() {
cat <<EOT
Usage: `basename $0` [-w|-c|-h]
-w warning_threshold
set warning threshold (default 20)
-c critical_threshold
@hfm
hfm / curl.md
Last active August 29, 2015 14:00

問題

raw.github.comがraw.githubusercontent.comにリダイレクトされるようになって、CentOS 6.5等でcurlがコケるようになってしまった。

(os xだと問題なく動いた)

$ cat /etc/redhat-release
CentOS release 6.5 (Final)
$ curl -vIL http://cpanmin.us
#!/usr/bin/env ruby
require 'uri'
if ARGV.size != 1
fail ArgumentError, "Set directory path like $HOME/.rbenv/versions/2.1.1/"
end
methods = []
Dir.glob(File.expand_path(ARGV[0]) + "/**/*.ri").each do |file|

こういうmanifestを用意した。

file { '/home/hfm/test':
  content => "world\n",
  backup  => true,
}

helloと書かれたtestファイルを用意。