Skip to content

Instantly share code, notes, and snippets.

@hiono
hiono / remove-ansi-escape-sequence
Last active July 8, 2022 11:31
ANSIエスケープシーケンスを除去する
alias rmescseq='sed -r "s:\x1B\[[0-9;]*[mK]::g"'
@hiono
hiono / build_vagrant-lxc-box_ubuntu.sh
Last active January 2, 2016 04:49
Shellscript to create the ubuntu-box of vagrant-lxc
#!/bin/bash
##################################################################################
# 1 - Prepare environments
RELEASE=trusty
ARCH=64 # OR 32
ADD_PACKAGES="vim,curl,wget,manpages,bash-completion,keychain,tmux,python-software-properties"
case ${ARCH} in
64) BOXNAME=${RELEASE}${ARCH}
ARCH=amd64 ;;
@hiono
hiono / add_ssh_config.sh
Last active October 24, 2016 14:03
Add a vagrant ssh-config data to ".ssh/config" file. Require plugin: vagrant-global-status
#!/bin/bash
SSH=$HOME/.ssh
[ ! -f $SSH/config ] && touch $SSH/config
[ -f $SSH/config ] && [ ! -f $SSH/config.orig ] && mv $SSH/config{,.orig}
rm -f $SSH/config.vagrant
touch $SSH/config.vagrant
for dir in $(vagrant global-status | grep $HOME)
do
pushd $dir > /dev/null
@hiono
hiono / gist:8451205
Last active January 3, 2016 10:39
[obsolute] SHLVL が 1 の時だけgit pullを巡回。ログイン時に回すのに使う。
#!/bin/bash
if [ ${SHLVL} -le 1 ];then
(cat <<EOM
/home/vagrant/.dotfiles
EOM
) | while read line
do
ls -d $line
pushd $line
git pull -v exit 1
@hiono
hiono / bitpulls.sh
Last active January 3, 2016 10:49
SHLVL が 1 の時だけgit pullを巡回。ログイン時に回すのに使う。
#!/bin/bash -eu
if [ ${SHLVL} -le 1 ];then
if [ -f ~/.gitupdates ];then
for i in $(cat ~/.gitupdates )
do
pushd $(eval "ls -d $i")
git pull -v || echo ERROR !!!!!!!!!!!!!!!!!!!
popd > /dev/null
done
GITHUB_URL_PREFIX="url.git@github.com:"
git config --global --remove-section "$GITHUB_URL_PREFIX" || :
git config --global "$GITHUB_URL_PREFIX".pushInsteadOf "git://github.com/"
git config --global --add "$GITHUB_URL_PREFIX".pushInsteadOf "https://github.com/"
OR
git config --global "url.git@github.com:.pushinsteadof" "https://github.com/"
@hiono
hiono / file0.txt
Created March 12, 2014 02:57
gitで自分用テンプレートを使う ref: http://qiita.com/highfrontier/items/43831e0d8fa490fc26ee
$ tree $HOME/work/.git_template
/home/XXX/work/.git_template
-- hooks
-- post-flow-release-finish
`-- post-flow-release-start
`-- info
`-- exclude
2 directories, 3 files
@hiono
hiono / .functions
Last active November 10, 2021 03:57
Shell Provisioner
#!/usr/bin/env bash
# load base functions
declare -F log_action_begin_msg > /dev/null
(( $? == 1 )) && source /lib/lsb/init-functions
# define checker
function _has_f () {
return 0;
}
@hiono
hiono / YAML_PARSER.md
Last active August 29, 2015 14:02
libyaml C-language wrapper

libyaml C-language wrapper

Need

  • libyaml
  • apach portable routine
@hiono
hiono / 0_reuse_code.js
Created January 13, 2016 17:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console