Skip to content

Instantly share code, notes, and snippets.

View hilotech's full-sized avatar

SHIOBARA Hiroaki hilotech

View GitHub Profile
@hilotech
hilotech / make_vim_env.sh
Last active August 29, 2015 14:07
vimのとりあえず設定
#!/bin/sh
[ -f ~/.screenrc ] || touch ~/.screenrc
grep -Fxq '# screenrc::256color-term-setting' ~/.screenrc \
|| cat >> ~/.screenrc <<_EOF_SCREENRC
# screenrc::256color-term-setting
attrcolor b ".I"
defbce on
termcapinfo xterm* 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
_EOF_SCREENRC
@hilotech
hilotech / docker-nsenter
Created October 16, 2014 06:50
Dockerコンテナにnsenterを使って入るんだけどコンテナIDを指定しなくていい手抜きスクリプト
#!/bin/sh
declare container_id=$1
DOCKER_PS=` \
docker ps \
| awk '\
BEGIN{L=1} \
!/^CONTAINER/{printf("<%d> %s\n", L, $0); L++;} \
/^CONTAINER/{print;} \
@hilotech
hilotech / install-atom-via-chocolatey.bat
Created November 4, 2014 01:30
Install Atom Editor to Windows (w/Cygwin) via Chocolatey
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
REM for CygWin Environment
mv /usr/bin/git /usr/bin/cyg-git
call cinst git
call cinst nodejs
call cinst atom
call apm install Sublime-Style-Column-Selection
call apm install atom-alignment
@hilotech
hilotech / gist:f9664a0e77644b479e33
Last active August 29, 2015 14:18
bash(>3) : getopts long options
# Usage: local -A __opts=`_getOptsArray --hoge=fuga --age=uge`
# to get the value: ${__opts["hoge"]}
function _getOptsArray() {
local __name=''
local __value=''
local __declaration=''
local -A __opts
for OPT in "$@"
do
__name=${OPT%%=*}
@hilotech
hilotech / pyaml2json.pl
Created April 4, 2015 07:25
YAML <-> JSON converter by Perl
#!/usr/bin/env perl
# pyaml2json.pl
# YAML <-> JSON converter by Perl
# Prerequisite installation (on CentOS 6.x)
# -----------------------------------------
# # yum -y install perl
# # curl -L https://cpanmin.us | perl - App::cpanminus
# # cpanm JSON YAML::Tiny
@hilotech
hilotech / localStorage test
Created April 10, 2015 01:08
localStorage test
<!DOCTYPE html>
<title>localStorage test</title>
<body>
<h1>localStorage test</h1>
<script>
if ( ! window.console ) {
console = {
log : function( s ) {
alert( s );
}
@hilotech
hilotech / HiLoTECH::Validate.pm
Last active August 29, 2015 14:19
ついカッとなってつくったバリデーター(今は公開している)
package HiLoTECH::Validate;
#@errs = HiLoTECH::Validate({
# data => $v,
# validates => [
# {
# target => 'mailaddr',
# rules => [
# [ sub { return 1 if ( !$_[0] ) },
# 'メールアドレスが入力されていません' ],
@hilotech
hilotech / install.sh
Created May 13, 2015 19:56
ConoHa [VPSでコラボ]Postfix+Dovecot構築スクリプト
#!/bin/bash
set -e
set -u
MY_DOMAIN='example.com'
MY_ADDR='127.0.0.1'
yum -y install postfix dovecot
/sbin/iptables -I INPUT -p tcp --dport smtp -j ACCEPT
@hilotech
hilotech / install.sh
Created May 13, 2015 19:59
ConoHa [VPSでコラボ]Mailmanでメーリングリスト構築スクリプト
#!/bin/bash
set -e
set -u
ML_SERVER='ml.example.com'
MAILMAN_ADMIN_PASSWORD='hogehoge1'
ADMINML_ADMIN='someone@example.com'
ADMINML_PASSWORD='hogehoge2'
@hilotech
hilotech / install.sh
Created May 13, 2015 20:01
ConoHa [VPSでコラボ]Slackライクなチャット構築スクリプト
#!/bin/bash
set -e
set -u
FQDN='chat.ml.example.com'
cat <<'_EOF_' > /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository