Skip to content

Instantly share code, notes, and snippets.

View bitzip's full-sized avatar
😀
Focusing

bitzip

😀
Focusing
View GitHub Profile
@bitzip
bitzip / uwsgi init.d
Last active August 29, 2015 13:56
uwsgi service
#! /bin/sh
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="uwsgi daemon"
UWSGI_DAEMON=/var/www/xcloud_site/xcloud_env/bin/uwsgi
UWSGI_CONF=/etc/uwsgi/uwsgi.ini
UWSGI_PID=/var/run/uwsgi-emperor.pid
@bitzip
bitzip / configuration conversion
Created February 14, 2014 09:32
configuration conversion
# configuration conversion
# 1.comment 2. example 3.grouping
[uwsgi]
# virtualenv dir path.
# EG:'/var/www/xcloud_site/xcloud_env'
home = ###
# django project path.
# EG:'/var/www/xcloud_site/repo'
@bitzip
bitzip / truncate.table.sh
Created March 15, 2014 09:38
truncate all mysql tables
#!/bin/bash
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
if [ $# -ne 3 ]
then
echo "Usage: $0 {MySQL-User-Name} {MySQL-User-Password} {MySQL-Database-Name}"
/**
* Open external links in new tab/window
*/
// All http:// links should open in new tab/window. Internal links are relative.
var anchors = document.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++) {
anchor = anchors[i];
@bitzip
bitzip / unstable_datetime.py
Last active August 29, 2015 14:13
列出指定时区从1970年01月01日至今,时区历史改动日期,以及夏令开始和结束日期。
# coding=utf8
"""
# 功能
列出指定时区从1970年01月01日至今,时区历史改动日期,以及夏令开始和结束日期。
# 时区改动
@bitzip
bitzip / tabclosetoleft.vim
Created November 2, 2015 06:46
Vim close tab page and focus on the left
let s:prevtabnum=tabpagenr('$')
augroup TabClosed
autocmd! TabEnter * :if tabpagenr('$')<s:prevtabnum && tabpagenr()>1
\ | tabprevious
\ |endif
\ |let s:prevtabnum=tabpagenr('$')
augroup END
@bitzip
bitzip / battery.cycle.sh
Created March 12, 2016 01:04
retrieve battery cycle in command line on Mac OS
system_profiler SPPowerDataType | grep Cycle | grep -oE '[0-9]+'
@bitzip
bitzip / tampermonkey-redmine-commit-text.user.js
Last active May 18, 2017 06:51
concatenate redmine title as commit text
// ==UserScript==
// @name redmine-issue-text
// @namespace https://gist.github.com/kelly-apollo/3943a049fd9cebb2ad5abaa6327a9245
// @version 0.2.2
// @description try to take over the world!
// @author Kelly Apollo
// @match *://redmine.gizwits.com/*
// @match *://redmine.xtremeprog.com/*
// ==/UserScript==
/* jshint -W097 */
@bitzip
bitzip / tampermonkey-redmine-issue-link.user.js
Last active May 18, 2017 06:53
为gitlab上的任务分支添加链接按钮到redmine
@bitzip
bitzip / watch.sh
Last active July 4, 2017 01:38 — forked from mikesmullin/watch.sh
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#