Skip to content

Instantly share code, notes, and snippets.

View qinshulei's full-sized avatar
🎯
Focusing

Qin Shulei qinshulei

🎯
Focusing
View GitHub Profile
@qinshulei
qinshulei / bash-setup.sh
Last active August 29, 2015 14:05
bash-setup
#!/bin/bash
#: Title : xxx.bash
#: Usage : xxx.bash [-m] [-i item] target
#: Synopsis : for bash script setup
#: Date : 2015-02-13 11:23:04
#: Author : shulei
#: version : 1.0
#: Description : be used to setup bash script for jenkins job or daily bash script
#: Required : target => which target
#: Options : -i set items
@qinshulei
qinshulei / rm_svn_files.sh
Created August 11, 2014 07:11 — forked from rafaelrinaldi/rm_svn_files.sh
rm all .svn form svn
# Remove SVN files from any folder
rm-svn-files() {
find "$1" -name *.svn | xargs rm -rf
}
@qinshulei
qinshulei / remove_svn.sh
Last active August 29, 2015 14:05
rm all .svn from svn
# Recursively remove all .svn directories
find . -name .svn -print0 | xargs -0 rm -rf
@qinshulei
qinshulei / is-command-exists
Last active August 29, 2015 14:05
check if command exists
# 1. use command -v
command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; }
# 2. use type .
if ! type "$foobar_command_name" > /dev/null; then
# install foobar here
fi
@qinshulei
qinshulei / total-code-numbers.sh
Last active August 29, 2015 14:07
caculate the total source code line numbers
#!/bin/bash
wc -l `find ../src/main -regex ".*\.\(java\|html\|js\|css\)" -not -path "../src/main/webapp/assets/bower_components/*" -not -path "../src/main/webapp/assets/components/*"`
wc -l $(find . -type f -regex ".*\.*\.*" -not -path "./.git/*")
@qinshulei
qinshulei / bash-space-separated.sh
Created October 22, 2014 07:03
bash-space-separated
#!/bin/bash
#usage: ./myscript.sh -e conf -s /etc -l /usr/lib /etc/hosts
while [[ $# > 1 ]]
do
key="$1"
shift
case $key in
-e|--extension)
EXTENSION="$1"
@qinshulei
qinshulei / bash-equals-separated.sh
Last active August 29, 2015 14:07
bash-equals-separated
#!/bin/bash
for i in "$@"
do
case $i in
-e=*|--extension=*)
EXTENSION="${i#*=}"
shift
;;
-s=*|--searchpath=*)
@qinshulei
qinshulei / bower.json
Created October 24, 2014 03:03
bower.json
{
"name": "canvas-clock",
"description": "A starter project for canvas",
"version": "0.0.0",
"license": "MIT",
"private": true,
"dependencies": {
"bootstrap": "~3.1.1"
}
}
@qinshulei
qinshulei / package.json
Created October 24, 2014 03:04
package.json
{
"version": "0.0.0",
"name": "canvas-clock",
"description": "A canvas clock ",
"private": true,
"license": "MIT",
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
},
@qinshulei
qinshulei / index.html
Created October 24, 2014 03:06
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Canvas clock</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="js/app.js"></script>