Skip to content

Instantly share code, notes, and snippets.

import time, threading, processing
for cls in [threading.Thread, processing.Process]:
start = time.time()
for _ in range(1000):
child = cls(target=lambda: None)
child.start()
child.join()
print 'Spawning 100 children with %s took %.2fs' % (
cls.__name__, time.time() - start)
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSLog(@"documentsDirectory: %@", resourcePath);
NSString *fontPath = [NSString stringWithFormat: @"%@/MinionPro-Regular.otf", resourcePath];
NSURL *fontURL = [NSURL fileURLWithPath: fontPath isDirectory: NO];
fontProvider = CGDataProviderCreateWithURL((CFURLRef) fontURL);
NSLog(@"%@, fontProvider = %p", fontURL, fontProvider);
mainFont = CGFontCreateWithDataProvider(fontProvider);
if [ "${ARCHS}" = "armv6" ]; then
CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate codesign -s "Jjgod Jiang" -f ${TARGET_BUILD_DIR}/${EXECUTABLE_FOLDER_PATH}/${EXECUTABLE_NAME}
fi
Thread 7 Crashed:
0 com.apple.JavaScriptCore 0x946f2940 WTF::fastRealloc(void*, unsigned long) + 3680
1 com.apple.JavaScriptCore 0x9476a2f2 KJS::ArrayInstance::put(KJS::ExecState*, unsigned int, KJS::JSValue*) + 1346
2 com.apple.JavaScriptCore 0x9470a827 KJS::stringProtoFuncSplit(KJS::ExecState*, KJS::JSObject*, KJS::List const&) + 1559
3 com.apple.JavaScriptCore 0x947c85a5 KJS::Machine::privateExecute(KJS::Machine::ExecutionFlag, KJS::ExecState*, KJS::RegisterFile*, KJS::Register*, KJS::ScopeChainNode*, KJS::CodeBlock*, KJS::JSValue**) + 28501
4 com.apple.JavaScriptCore 0x947c9098 KJS::Machine::execute(KJS::FunctionBodyNode*, KJS::ExecState*, KJS::FunctionImp*, KJS::JSObject*, KJS::List const&, KJS::RegisterFileStack*, KJS::ScopeChainNode*, KJS::JSValue**) + 760
5 com.apple.JavaScriptCore 0x947061ef KJS::FunctionImp::callAsFunction(KJS::ExecState*, KJS::JSObject*, KJS::List const&) + 127
6 com.apple.JavaScriptCore 0x94730af7 KJS::JSObject::call(K
NSString *message = [NSString stringWithUTF8String: "Hello"];
int count = [message length];
UniChar *characters = (UniChar *) malloc(count * sizeof(UniChar));
CGGlyph *glyphs = (CGGlyph *) malloc(count * sizeof(CGGlyph));
int *advances = (int *) malloc(count * sizeof(int ));
CGSize *cgAdvances = (CGSize *) malloc(count * sizeof(CGSize));
/* Get the characters, glyphs and advances and calculate aStringWidth. */
[message getCharacters: characters];
#!/usr/bin/env python
import sys, urllib
url = urllib.unquote(sys.argv[1])
def plus13(c):
i = ord(c)
if i >= ord('a') and i <= ord('z'):
i += 13
$ ./ias.py
2009-03-18 18:01:29 URL:http://att.newsmth.net/att.php?p.874.1114207.284.JPG [395576/395576] -> "MyPhoto/IMG_0270.JPG" [1]
2009-03-18 18:01:29 URL:http://att.newsmth.net/att.php?p.874.1114219.298.png [432163/432163] -> "MyPhoto/1.png" [1]
2009-03-18 18:01:30 URL:http://att.newsmth.net/att.php?p.874.1114178.425.jpg [167389/167389] -> "MyPhoto/post_xin9.jpg" [1]
2009-03-18 18:01:31 URL:http://att.newsmth.net/att.php?p.179.710172.531.jpg [275847/275847] -> "DSLR/风车3.jpg" [1]
2009-03-18 18:01:32 URL:http://att.newsmth.net/att.php?p.179.710174.240.jpg [129165/129165] -> "DSLR/IMG_2383-20.jpg" [1]
2009-03-18 18:01:33 URL:http://att.newsmth.net/att.php?p.179.710152.441.jpg [135363/135363] -> "DSLR/chinon135.2.8.jpg" [1]
...
#!/usr/bin/env python
# coding: utf-8
import ConfigParser, urllib, codecs, os, time
config = ConfigParser.ConfigParser()
config.read('ias.cfg')
board_url = "http://www.newsmth.net/bbsdoc.php?board=%s"
board_page_url = "http://www.newsmth.net/bbsdoc.php?board=%s&&page=%d"
post_url = "http://www.newsmth.net/bbscon.php?bid=%d&id=%d"
[MyPhoto]
lastcheck = 1237371285
[DSLR]
lastcheck = 1237371323
[basic]
boards = MyPhoto, DSLR
>>> Connecting
>>> debug is [5]
>>> host is [gmail.com]
>>> account is [dhxygroup]
>>> resource is [conference]
DEBUG: stream init called
>>> Logging in
DEBUG: jabberpy connect called
DEBUG: client connect called to gmail.com 5223 type 2
DEBUG: Attempting to create ssl socket