Skip to content

Instantly share code, notes, and snippets.

@darkseed
darkseed / wikipedia_links.py
Created May 31, 2011 22:23 — forked from mnot/wikipedia_links.py
Pull links out of a Wikipedia XML dump, real fast.
@darkseed
darkseed / gexport.py
Created May 31, 2011 22:23 — forked from mnot/gexport.py
gexport.py - Export Google Docs to a local directory
#!/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/
"""
@darkseed
darkseed / sparkogram.py
Created May 31, 2011 22:28 — forked from mnot/sparkogram.py
sparkogram.py: Sparkline histogram generator
#!/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__ = """
@darkseed
darkseed / chatterbox.py
Created May 31, 2011 22:29 — forked from mnot/chatterbox.py
Chatterbox - System monitoring through social networking
#!/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.
@darkseed
darkseed / bootstrap.sh
Created June 2, 2011 19:00 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
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
@darkseed
darkseed / UIViewController+MBSensitiveInformationInScreenshotPrevention.h Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)
@darkseed
darkseed / gist:1085628
Created July 15, 2011 21:55
Block based notification
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");
@darkseed
darkseed / gist:1127659
Created August 5, 2011 14:31
Fibonacci
int Fibonacci(int k)
{
double phi = 0.5*(1.0 + sqrt(5.0));
return int( pow(phi, k)/sqrt(5.0) + 0.5 );
}
@darkseed
darkseed / CustomUITabbarm
Created August 7, 2011 20:45
UITabbar with background
- (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];
@darkseed
darkseed / gist:1136617
Created August 10, 2011 11:36
Cucumber keeping the browser open
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