Skip to content

Instantly share code, notes, and snippets.

@cougarwww
cougarwww / macapp.go
Created May 22, 2018 03:16 — forked from mholt/macapp.go
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
import datetime
from django.utils.timezone import utc
start_date = datetime.datetime.utcnow().replace(tzinfo=utc) - datetime.timedelta(minutes=1)
end_date = datetime.datetime.utcnow().replace(tzinfo=utc)
old_date = datetime.datetime(2013, 1, 1).replace(tzinfo=utc)
run_crons = applyDB.objects.filter(status='2', apply_run_time__range=(start_date, end_date)) # 申请通过,到期执行
old_crons = applyDB.objects.filter(status='1', apply_run_time__range=(old_date, end_date)) # 申请到期未审核
@cougarwww
cougarwww / vim-tip.txt
Created December 16, 2012 07:24
vim: tip
d0 删至行首。
d$ 删至行尾。
dw 删除到某个单词的结尾位置
D 删除到行尾
x,y 删除与复制包含高亮区
dL 删除直到屏幕上最后一行的内容
dH 删除直到屏幕上第一行的内容
dd 删除当前行
ndd 删除当前行及其后 n-1 行。
x 或 X 删除一个字符。
@cougarwww
cougarwww / django-uwsgi-reload.py
Created December 15, 2012 17:59
python: django uwsgi autoreload
import uwsgi
from uwsgidecorators import timer
from django.utils import autoreload
@timer(3)
def change_code_gracefull_reload(sig):
if autoreload.code_changed():
uwsgi.reload()
@cougarwww
cougarwww / hg-hooks-for-branch.sh
Created November 27, 2012 09:29
shell: hg hooks for branch
#!/bin/bash
#set -x
if [ "$#" -lt 2 ]
then
echo -e "Not enouth args"
exit 1
fi