Skip to content

Instantly share code, notes, and snippets.

@hofmannsven
hofmannsven / README.md
Last active February 2, 2024 20:47
Raspberry Pi Cheatsheet
@mayoff
mayoff / makeAnimatedGif.m
Created February 16, 2013 23:00
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@admsyn
admsyn / README.txt
Created November 24, 2012 15:45
Keep an installation alive with launchd & launchctl
Add this .plist to ~/Library/LaunchAgents to have it automatically
take effect whenever you log in. It will continue to be active until
you log out (even if you delete the file).
You can take manual control over it instead by putting the file
anywhere else, then using launchctl like this:
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
launchctl load path/to/the/plist/com.admsyn.keep-twitter-alive.plist
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()