Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| def wc (fname, options = "-l"): | |
| p = subprocess.Popen(['wc', options, fname], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
| result, err = p.communicate() | |
| if p.returncode != 0: | |
| return -1 | |
| return int(result.strip().split()[0]) | |
| def tail (fname, n = 30, out = subprocess.PIPE): |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| git clean -xfd | |
| git submodule foreach --recursive git clean -xfd | |
| git reset --hard | |
| git submodule foreach --recursive git reset --hard | |
| git submodule update --init --recursive |
| " NeoBundle Scripts--------------------------------- | |
| if has('vim_starting') | |
| set runtimepath+=~/.config/nvim/bundle/neobundle.vim/ | |
| set runtimepath+=~/.config/nvim/ | |
| endif | |
| let neobundle_readme=expand('~/.config/nvim/bundle/neobundle.vim/README.md') | |
| if !filereadable(neobundle_readme) | |
| echo "Installing NeoBundle..." |
| package main | |
| import ( | |
| "encoding/csv" | |
| "encoding/json" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "log" |
| import java.security.SecureRandom; | |
| import java.math.BigInteger; | |
| final class StringGenerator { | |
| private SecureRandom random = new SecureRandom(); | |
| public String next() { | |
| return new BigInteger(128, random).toString(32); | |
| } |
| func dist(lat1, lon1, lat2, lon2 float64) float64 { | |
| const R = 1000.0 * 6378.132 // Radius of earth in m. | |
| lat := lat2*math.Pi/180.0 - lat1*math.Pi/180.0 | |
| lon := lon2*math.Pi/180.0 - lon1*math.Pi/180.0 | |
| a := math.Sin(lat/2.0)*math.Sin(lat/2.0) + math.Cos(lat1*math.Pi/180.0)*math.Cos(lat2*math.Pi/180.0)*math.Sin(lon/2.0)*math.Sin(lon/2.0) | |
| c := 2.0 * math.Atan2(math.Sqrt(a), math.Sqrt(1.0-a)) | |
| d := R * c | |
| return d |
| execute pathogen#infect() | |
| let g:go_fmt_command = "goimports" | |
| let g:clang_format#detect_style_file=1 | |
| let g:clang_format#auto_format=1 | |
| let NERDTreeShowHidden=1 | |
| set autoindent | |
| set tabstop=4 " Show existing tab with 4 spaces width | |
| set shiftwidth=4 " When indenting with '>', use 4 spaces width |
| get_latest_release() { | |
| curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
| grep '"tag_name":' | # Get tag line | |
| sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
| } | |
| # Usage | |
| # $ get_latest_release "creationix/nvm" | |
| # v0.31.4 |