This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
#所需的函数: | |
p_99, 使用js 内置的parseInt,做比较; | |
或 | |
re_99,使用正则式做匹配测试。 | |
如果只想匹配 2 位的数字,忽略1位的数字,将 [0-9]{1,2} 改为 [0-9]{2} 即可。 | |
### | |
p_99 = (degree) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function djcmd () { | |
if [[ "$#" -lt 1 ]] | |
then | |
echo "Usage: $FUNCNAME <must_args> [optional_args]" | |
return | |
else | |
mkdir -p management/commands | |
touch management/__init__.py | |
touch management/commands/__init__.py | |
touch management/commands/_private.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# | |
# Author: Rex Zhang | |
# Create Time: 2013-07-28 12:32 | |
# File name: unzipgbk.py | |
""" | |
./unzipgbk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# | |
# Author: Rex Zhang | |
# Create Time: 2013-07-04 16:14 | |
# File name: makecoffee.py | |
import os | |
import re | |
import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# | |
# Author: Rex Zhang | |
# Create Time: 2013-06-13 10:54 | |
# File name: att.py | |
from hashlib import md5 | |
import argparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def no_cache(): | |
def decorator(f): | |
def wrapper(*args, **kwargs): | |
response = f(*args, **kwargs) | |
response['Last-Modified'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()) | |
response['Expires'] = 'Wed, 11 Jan 1984 05:00:00 GMT' | |
response['Cache-Control'] = 'no-cache, must-revalidate, max-age=0' | |
response['Pragma'] = 'no-cache' | |
return response | |
return wrapper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# | |
# Author: Rex Zhang | |
# Create Time: 2013-01-29 11:50 | |
# File name: xladd.py | |
""" | |
usage: | |
xladd "string that contains downloadable resources, like ed2k, magnet, thunder." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env coffee -bc $0 | |
class DateDiff | |
constructor: (dateStr='') -> | |
try | |
[year, month, date, hour, min] = dateStr.match(///^(\d{4}) | |
-(\d{2}) | |
-(\d{2}) | |
\s | |
(\d{2}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#urls.py | |
url(r'^media/font/(?P<font>.*(?:eot|ttf|oft|woff))$', views.font, name='font'), | |
#views | |
import os | |
from django.conf import settings | |
def font(request, font): | |
font_fn = os.path.abspath(os.path.join(settings.MEDIA_ROOT, 'font/%s' % font)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec osascript <<EOF | |
set peopleICareAbout to {"MyFullName"} | |
tell application "Messages" | |
repeat with myBuddy in buddies | |
if full name of myBuddy is in peopleICareAbout then | |
send "$*" to myBuddy | |
end if | |
end repeat |