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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# Pull links out of a Wikipedia XML dump on STDIN and spit them out on | |
# STDOUT. | |
from mwlib.uparser import parseString as parseWikiMarkup | |
from xml.dom import pulldom | |
import sys |
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
#!/usr/bin/env python | |
"""\ | |
gexport.py | |
Export Google Docs to a local directory. | |
Requires the GData Python client library: | |
http://code.google.com/p/gdata-python-client/ | |
""" |
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
#!/usr/bin/env python | |
""" | |
sparkogram.py - Sparkline histogram generator | |
This is quick and dirty. Based on Joe Gregorio's sparkline thoughts; | |
<http://bitworking.org/news/Sparklines_in_data_URIs_in_Python>. | |
""" | |
__license__ = """ |
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
#!/usr/bin/env python | |
""" | |
Chatterbox - System monitoring through Social Networking. | |
Chatterbox uses Twitter, IM and eventually other "social" channels to | |
send you information about your systems, so that you can keep in touch | |
with how they're performing without lots of messages in your e-mail inbox | |
or on your pager. |
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
virtualenv --no-site-packages . | |
source bin/activate | |
bin/pip install Django psycopg2 django-sentry | |
bin/pip freeze > requirements.txt | |
bin/django-admin.py startproject mysite | |
cat >.gitignore <<EOF | |
bin/ | |
include/ | |
lib/ | |
EOF |
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
// | |
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h | |
// | |
// Created by Manuel Binna on 05.05.11. | |
// Copyright 2011 Manuel Binna. All rights reserved. | |
// | |
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention) |
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
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; | |
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; | |
[nc addObserverForName:UIDeviceOrientationDidChangeNotification object:nil | |
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif){ | |
UIDeviceOrientation orientation; | |
orientation = [[UIDevice currentDevice] orientation]; | |
if (UIDeviceOrientationIsPortrait(orientation)) { | |
NSLog(@"portrait"); | |
} else { | |
NSLog(@"landscape"); |
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
int Fibonacci(int k) | |
{ | |
double phi = 0.5*(1.0 + sqrt(5.0)); | |
return int( pow(phi, k)/sqrt(5.0) + 0.5 ); | |
} |
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
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
CGRect frame = CGRectMake(0, 0, 480, 49); | |
UIView *v = [[UIView alloc] initWithFrame:frame]; | |
UIImage *i = [UIImage imageNamed:@"GO-21-TabBarColorx49.png"]; | |
UIColor *c = [[UIColor alloc] initWithPatternImage:i]; | |
v.backgroundColor = c; | |
[c release]; |
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
After do |scenario| | |
KEEP_OPEN = true if scenario.status == :pending or scenario.status == :undefined | |
end | |
at_exit do | |
browser.close if not KEEP_OPEN | |
end |