start new:
tmux
start new with session name:
tmux new -s myname
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder |
#! /usr/bin/env python | |
#coding=utf-8 | |
#----config part---- | |
INIT_CMDS = ["iptables -F",#clean all | |
"iptables -X", | |
"iptables -t nat -F", | |
"iptables -t nat -X", | |
"iptables -P INPUT DROP",#forbid all | |
"iptables -A INPUT -i lo -j ACCEPT"#accept all localhost |
/* Gmail style scrollbar */ | |
::-webkit-scrollbar { | |
width: 12px | |
} | |
::-webkit-scrollbar-thumb { | |
border-width: 1px 1px 1px 2px | |
} | |
::-webkit-scrollbar-track { | |
border-width: 0 | |
} |
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
pip install virtualenvwrapper | |
source /usr/local/bin/virtualenvwrapper.sh | |
cat >> ~/.bashrc << “END” | |
export WORKON_HOME=$HOME/.virtualenvs | |
source /usr/local/bin/virtualenvwrapper.sh | |
END | |
mkvirtualenv myenv | |
workon myenv |
# -*- coding: utf-8 -*- | |
from django import forms | |
from crispy_forms.helper import FormHelper | |
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field | |
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions | |
class MessageForm(forms.Form): | |
text_input = forms.CharField() |
import random | |
import collections | |
import bisect | |
def weighted_random_choice(candidates, field='weight'): | |
''' | |
use bisect to random get items with weighted probability, the weight field can be specified | |
''' | |
prepared_candidates = {} | |
total_weight = 0 |
export DJANGO_SETTINGS_MODULE='my_project.settings' | |
cd my_project/ | |
python manage.py shell | |
from django.core.cache import cache | |
cache.clear() |
hardstatus on | |
hardstatus alwayslastline | |
hardstatus string "%{.bW}%-w%{.rY}%n %t%{-}%+w %=%{..G} %H(%l) %{..Y} %Y/%m/%d %c:%s " | |