Skip to content

Instantly share code, notes, and snippets.

View lirenlin's full-sized avatar

Renlin Li lirenlin

View GitHub Profile
@lirenlin
lirenlin / vimrc
Last active December 19, 2015 10:49
set nocompatible
filetype off " required!
if has('win32') || has('win64')
set rtp+=~/vimfiles/bundle/vundle/
call vundle#rc('$HOME/vimfiles/bundle/')
else
" Usual quickstart instructions
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
@lirenlin
lirenlin / git_prompt
Created July 25, 2013 15:29
show git branch in command prompt
parse_git_branch ()
{
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#(git::\1)#'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\[\033[01;36m\]$(parse_git_branch)\$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n$(parse_git_branch)\$ '
fi
@lirenlin
lirenlin / C_from_d.vim
Last active December 23, 2015 10:49
Generate ChangeLog file from diff file
" File: C_from_D.vim
" Author: Renlin Li
" Version: 0.01
" Description: Generate a simple ChangeLog template from a diff file.
"
if exists('loaded_genCL')
finish
endif
let loaded_genCL = 1
@lirenlin
lirenlin / sub_string
Last active December 23, 2015 21:39
replace all the occurrences of old text with new text
sed -i 's/old-word/new-word/g' *.txt
sed 's/old-word/new-word/g' input.txt > output.txt
@lirenlin
lirenlin / grep_opt
Last active December 24, 2015 00:19
More grep search options
grep -R --include="*.txt" "pattern" /path/to/dir
grep -R --include=*.{c,h} "pattern" /path/to/dir
grep -R --include="*.c" --include="*.h" "pattern" /path/to/dir
-R recursively
-i ignore case
-n show line number
--include "pattern"
--exclude "pattern"
@lirenlin
lirenlin / find_depth
Created September 26, 2013 15:58
fine depth option
find . -maxdepth 3 -type f -name "file"
@lirenlin
lirenlin / gist:6781806
Created October 1, 2013 17:07
check the log of deleted file
git log -- deletedFile.txt
@lirenlin
lirenlin / gist:6827335
Created October 4, 2013 14:55
Disable desktop when starting nautilus
gsettings set org.gnome.desktop.background show-desktop-icons false
dconf-editor also works, uncheck:
draw-background
show-desktop-icons
@lirenlin
lirenlin / gist:6834388
Created October 4, 2013 23:14
terminator configuration
[global_config]
title_hide_sizetext = True
enabled_plugins = LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
[keybindings]
[profiles]
[[default]]
use_system_font = False
font = DejaVu Sans Mono 10
background_darkness = 0.7
background_type = transparent
@lirenlin
lirenlin / gist:6870875
Last active December 24, 2015 22:09
debug use qemu
qemu-arm -g 1234 a.out &
gdb-arm
file a.out
target remote localhost:1234
b main
c
s
info registers r1
i r r1