Skip to content

Instantly share code, notes, and snippets.

View babarot's full-sized avatar
🇯🇵
Wa

Masaki ISHIYAMA babarot

🇯🇵
Wa
View GitHub Profile
@babarot
babarot / hello.c
Last active August 29, 2015 14:02
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("hello, world\n");
exit(0);
}
#!/bin/bash
function original_ls()
{
printf '%s\n' ${1:+${1%/}/}*;
}
function original_cat()
{
local IFS=$'\n'
@babarot
babarot / gist:fa7812713a3d3213793c
Created June 28, 2014 08:08
Check if commands are executed successfully
#!/bin/bash
successfully() {
$* || (echo "failed" 1>&2 && exit 1)
}
@babarot
babarot / func.vim
Created July 2, 2014 10:42
function templete for vim
function Func(flg)
if a:flg
echo "true"
else
echo "false"
endif
endfunction
call Func(0)
@babarot
babarot / disable_aliases.sh
Created July 4, 2014 02:54
How to disable to alias
# -u is unset
shopt -u expand_aliases
# unalias command
# disable alias of ls
unalias ls
# -a is all
unalias -a
# immediately disable alias if ls
@babarot
babarot / allerrors_devnull
Created September 18, 2014 09:31
Dump errors to /dev/null
exec 3>&2
exec 2>/dev/null
# Some commands
exec 2>&3
@babarot
babarot / vim_intro.txt
Last active April 11, 2021 04:24
All you need is VIM ascii art
..
.::::.
___________ :;;;;:`____________
\_________/ ?????L \__________/
|.....| ????????> :.......'
|:::::| $$$$$$"`.:::::::' ,
,|:::::| $$$$"`.:::::::' .OOS.
,7D|;;;;;| $$"`.;;;;;;;' .OOO888S.
.GDDD|;;;;;| ?`.;;;;;;;' .OO8DDDDDNNS.
'DDO|IIIII| .7IIIII7' .DDDDDDDDNNNF`
@babarot
babarot / richpager_fix_styles_bug.patch
Created June 22, 2015 10:17
py3 compatibility issue
diff --git bin/richpager bin/richpager
index fcaa518..43aa067 100755
--- bin/richpager
+++ bin/richpager
@@ -24,7 +24,7 @@ if has 'python'; then
#
get_styles="from pygments.styles import get_all_styles
styles = list(get_all_styles())
- print '\n'.join(styles)"
+ print('\n'.join(styles))"
@babarot
babarot / get_last_pane_path.sh
Last active April 11, 2021 04:23
Get last pane path
if [[ -z $TMUX ]]; then
echo "you are not on tmux" >&2
exit 1
fi
if [[ $1 =~ ^[0-9]+$ ]]; then
arg="-t $1"
fi
{
@babarot
babarot / zplug-fzf
Created August 19, 2016 07:46
fzf & fzf-tmux
zplug "junegunn/fzf", \
as:command, \
use:"bin/fzf-tmux"
zplug "junegunn/fzf-bin", \
as:command, \
from:gh-r, \
rename-to:"fzf"