Skip to content

Instantly share code, notes, and snippets.

import sys
import re
print 'sys.maxunicode', sys.maxunicode
print 'internal string encoding is', sys.maxunicode > 65536 and 'UCS4' or 'UCS2'
# These bytes are a utf-8 encoded cake, see https://codepoints.net/U+1F370
cake = '\xF0\x9F\x8D\xB0'.decode('utf-8')
print 'cake is', cake
<span class="sg-embed-wrapper"
data-url="//snapguide.com/embed/v1/guide/properly-adjust-your-water-heater-temperature/"
data-format="wide"
data-slug="properly-adjust-your-water-heater-temperature"
data-width="646px"
data-height="490px"
>
Check out <a href="http://snp.gd/ha66hc">How to Properly Adjust Your Water Heater Temperature</a> by
<a target="_blank" href="//snapguide.com/james-barrett/">James Barrett</a> on
<a href="//snapguide.com/">Snapguide</a>.
some macros:
#define SGAM_ERROR_MESSAGE(condition, message) \
do { \
if (!(condition)) { \
SGAMError *__error__ = [[SGAMError alloc] initWithMesage:message \
asset:asset_ \
file:__FILE__ \
lineNumber:__LINE__]; \
return [__error__ autorelease]; \
@skrul
skrul / gist:2051046
Created March 16, 2012 16:45
Symbolicating iOS crashes with Xcode 4.3.1's symbolicatecrash script
Seems to help now to give the path to the symbols that match the version of iOS that produced the crash.
For iOS 5.1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -v crashfile /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.1\ \(9B176\)/Symbols
For iOS 5.0.1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash -v crashfile ~/Library/Developer/Xcode/iOS\ DeviceSupport/5.0.1\ \(9A405\)/Symbols
import urllib2, socket
import sys
socket.setdefaulttimeout(10)
def is_bad_proxy(pip):
try:
proxy_handler = urllib2.ProxyHandler({'https': pip})
opener = urllib2.build_opener(proxy_handler)
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
from socket import gethostname
APP_IDS = {
# bamboo-dev-surfer.local
'surfer.local': '118194594902144',
# bamboo-dev-heavybits.local
'heavybits.local': '160051217345246'}
def get_application_id():
hostname = gethostname()
---> create ~/bin/git-diff-cmd.sh
#!/bin/sh
/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge -left "$2" -right "$5"
---> configure git
git config --global diff.external ~/bin/git-diff-cmd.sh