This file contains 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
import sys | |
import uuid | |
import textwrap | |
from PIL import Image | |
from PIL import ImageFont | |
from PIL import ImageDraw | |
def generate(img, text): |
This file contains 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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
This file contains 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 | |
PWD=<YOUR-PASSWORD> | |
SERVICE=Wi-Fi | |
surgeIP="127.0.0.1" | |
surgePORT="6152" | |
surgePASS_DOMAIN=(127.0.0.1 192.168.0.0/16 10.0.0.0/8 172.16.0.0/12 localhost *.local) |
This file contains 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
#define KOBE_DEBUG NSLog(@"TableView in %@ || frame:%@ , bounds:%@, contentSize:%@ , contentOffSet:%@, contentInset:%@", NSStringFromSelector(_cmd), NSStringFromCGRect(self.tableView.frame), NSStringFromCGRect(self.tableView.bounds), NSStringFromCGSize(self.tableView.contentSize), NSStringFromCGPoint(self.tableView.contentOffset), NSStringFromUIEdgeInsets(self.tableView.contentInset)); |
This file contains 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
from datetime import datetime | |
import time | |
dt = datetime(2015, 8, 1, 0, 0, 0, 0) | |
timestamp = (dt - datetime(1970, 1, 1)).total_seconds() | |
print timestamp |
This file contains 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(req, res, db) { | |
db.collection("location").count(function(err, location_count){ | |
db.collection("actor").count(function(err, actor_count){ | |
db.collection("record").count(function(err, record_count){ | |
res.json({ | |
location_count: location_count, | |
actor_count: actor_count, | |
record_count: record_count | |
}); | |
}); |
This file contains 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
import webbrowser | |
import os | |
urls = [ | |
'http://www.douban.com', | |
'http://weibo.com', | |
'http://www.zhihu.com', | |
'http://www.v2ex.com/', | |
'https://github.com/', | |
'https://mail.google.com/', |
This file contains 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
from gevent import monkey; monkey.patch_all() | |
import gevent | |
import gevent.greenlet | |
from functools import partial | |
from random import random | |
import urllib | |
import urllib2 | |
def on_exception(fun, greenlet): |
This file contains 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
from datetime import datetime | |
# Get a datetime object | |
now = datetime.now() | |
# General functions | |
print "Year: %d" % now.year | |
print "Month: %d" % now.month | |
print "Day: %d" % now.day | |
print "Weekday: %d" % now.weekday() # Day of week Monday = 0, Sunday = 6 |
This file contains 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
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
NewerOlder