Skip to content

Instantly share code, notes, and snippets.

View jarvys's full-sized avatar

Jarvis Young jarvys

View GitHub Profile
@jarvys
jarvys / track-remote-branch.md
Last active August 29, 2015 14:00
make an existed local branch to track a remote branch
# The local branch is named LOCAL and the remote branch is named REMOTE
$ git checkout -b LOCAL-track origin/REMOTE
$ git branch -d LOCAL
$ git branch -m LOCAL

#Makefile

PORT:=9000
PROJECT:=project

start-uwsgi:
	uwsgi --socket 127.0.0.1:$(PORT) \
		  --chdir $(shell pwd) \
 --wsgi-file $(PROJECT)/wsgi.py \
@jarvys
jarvys / make-single-function-module.md
Last active August 29, 2015 14:00
make a module with only one function
import sys
  
def fn():
  pass
  
sys.modules[__name__] = fn
@jarvys
jarvys / make-simple-python-module.md
Last active August 29, 2015 14:00
workflow: how to make a simple python module

#dependencies

#workflow

pyinit #create setup.py template
@jarvys
jarvys / run-multiple-redis-instances.md
Last active September 27, 2022 13:02
run multiple redis instances on the same server for centos
  • create a new redis .conf file
$ cp /etc/redis.conf /etc/redis-xxx.conf
  • edit /etc/redis-xxx.conf, illustrated as below
...
def path_prefix(path):
    def wrapper(instance, filename):
        ext = filename.split('.')[-1]
        filename = '{}.{}'.format(uuid4().hex, ext)
        return os.path.join(path, filename)
    return wrapper
@jarvys
jarvys / Makefile
Last active September 21, 2015 09:08
my makefile for django project
host:=0.0.0.0
port:=8000
activate_venv=source venv/bin/activate
debug:
./manage.py runserver $(host):$(port)
start-uwsgi:
$(activate_venv) \
&& uwsgi --socket 127.0.0.1:$(port) \
@jarvys
jarvys / 0_reuse_code.js
Created June 19, 2014 03:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jarvys
jarvys / prepare-install-python2.7-centos.md
Last active August 29, 2015 14:03
prepare for installing python2.7 in centos
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
#nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1