Skip to content

Instantly share code, notes, and snippets.

require 'sinatra'
require 'json'
require 'droplet_kit'
DO_TOKEN = 'YOUR_TOKEN'
DATA_JSON_FILE = './data.json'
set :bind, '0.0.0.0'
def do_client
@Genki-S
Genki-S / auto-ssh-agent-start-and-kill.sh
Last active January 8, 2020 05:20
Automatically start ssh-agent when necessary, and kill ssh-agent when ssh is done (to not leave many ssh-agent processes around)
ssh() {
if [ -z "$SSH_AGENT_PID" ]; then
eval "$(ssh-agent -s)"
# ssh-add OTHER_KEYS
fi
command ssh $@
kill $SSH_AGENT_PID
unset SSH_AGENT_PID
}
#!/bin/sh
for f in $@; do
echo $f >> $(git rev-parse --show-toplevel)/.git/info/exclude
done
#!/bin/sh
# See file status life cycle: http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository
untracked=$(git status --porcelain 2>/dev/null | grep "^??")
modified=$(git status --porcelain 2>/dev/null | grep "^ M")
staged=$(git status --porcelain 2>/dev/null | grep "^M")
if [ -n "$untracked" -o -n "$modified" -o -n "$staged" ]; then
echo "Working tree not clean." 1>&2
exit 1
function exists { which $1 &> /dev/null }
if exists percol; then
function percol_select_history() {
local tac
exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
# Emacs like
percol.import_keymap({
"C-a" : lambda percol: percol.command.beginning_of_line(),
"C-e" : lambda percol: percol.command.end_of_line(),
"C-b" : lambda percol: percol.command.backward_char(),
"C-f" : lambda percol: percol.command.forward_char(),
"C-d" : lambda percol: percol.command.delete_forward_char(),
"C-h" : lambda percol: percol.command.delete_backward_char(),
"C-k" : lambda percol: percol.command.kill_end_of_line(),
"C-y" : lambda percol: percol.command.yank(),
NeoBundle "user/repo", {
\ 'lazy' : 1,
\ 'autoload' : {
\ 'filetypes' : ['vim', 'elisp']
\ 'commands' : ['Command']
\ 'mappings' : ['<Plug>(pluign_mapping)']
\ }
\}
" By using NeoBundleLazy command
NeoBundleLazy "user/repo"
" By passing options to NeoBundle command
NeoBundle "user/repo", {
\ 'lazy' : 1,
\}
# Add repositories: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x
# Add EPEL repo
wget http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6*.rpm
# Add remi repo
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm
@Genki-S
Genki-S / ins_vim.sh
Last active December 29, 2015 05:39
yum install mercurial -y
hg clone https://vim.googlecode.com/hg/ vim
cd vim
hg pull
hg update
yum install ncurses-devel -y
./configure \
--enable-gui=no \
--without-x \