Skip to content

Instantly share code, notes, and snippets.

View yuki777's full-sized avatar

Yuki Adachi yuki777

View GitHub Profile
@yuki777
yuki777 / .bashrc
Created November 25, 2011 01:45
.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Aliases
alias ls='ls -AFhs --color'
@yuki777
yuki777 / .vimrc.min
Created December 9, 2011 07:36
.vimrc.min
set nocp
filetype plugin on
set noswapfile
set history=10000
set ignorecase
set smartcase
set noincsearch
set nowrapscan
set hlsearch
nmap <silent> <Esc><Esc> :nohlsearch<CR>:set nopaste<CR><Esc>
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@yuki777
yuki777 / php-unserialize.zsh
Created April 27, 2012 01:36
php serializeされたfileをzshからprintする関数
# ~/.zshrc
# ex : php-unserialize PhpSerialized.text
function php-unserialize() {
php -r "print_r(unserialize(file_get_contents('$*')));"
}
@yuki777
yuki777 / .htaccess
Created July 19, 2012 01:41
maintenance .htaccess
# maintenance文言のHTMLファイル用意しておく
ErrorDocument 503 /maintenance.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/maintenance.html [NC]
RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !\.jpg$
@yuki777
yuki777 / sssh
Last active October 13, 2015 00:18
sssh
#!/bin/bash
# usage: sssh [server]
# "sssh" dependent on "sshpass"
ssh_login(){
if [ $# -ne 1 ]; then
echo 'usage: sssh [server]'
exit
fi
@yuki777
yuki777 / make_db.bash
Created July 29, 2013 15:21
make db bash script.
#!/bin/bash
# check
if [ $# -ne 3 ]; then
echo "usage : /bin/bash make_db.bash {project} {password} {mysql_root_pass}"
echo "e.g. : /bin/bash make_db.bash ProjectA PWhoge MySQLRootPW"
exit 1
fi
# vars
@yuki777
yuki777 / gist:9524301
Last active August 29, 2015 13:57
install latest vim to ~/local on ubuntu
mkdir -p ~/local/src
cd $_
hg clone https://vim.googlecode.com/hg/ vim
cd vim/src
sudo apt-get install libncurses5-dev lua5.2 luajit liblua5.2-dev nodejs
# yum
# sudo yum install -y mercurial gcc ncurses-devel lua lua-devel
./configure --prefix=$HOME/local --enable-luainterp=yes --enable-pythoninterp=yes --enable-rubyinterp=yes --enable-multibyte --enable-gui=no --with-features=huge --without-x
# vars
project_name=rdev
ip=192.168.33.22 # ip address that you want to use
user_name=yuki # user name that you want to create
# install, settings
cd ~/vagrant/vagrant/
vagrant box add $project_name _base/ubuntu-14.04-amd64-vbox.box
mkdir $project_name
cd $project_name
@yuki777
yuki777 / gist:926a74186e6ee91309b5
Created November 4, 2014 06:59
.git/hooks/prepare-commit-msg
#!/bin/bash
file=$1
mode=$2
if [ "$mode" = "" ] || [ "$mode" = "message" ] ; then
branch=`git rev-parse --abbrev-ref HEAD`
if [ "$branch" != "master" ]; then
if [ "$branch" != "" ]; then
mv $file $file.tmp