Format:
- Format: FLAC
- Sample Rate: 16000Hz
- Chanels: 1 (mono)
- Depth: 16bit
- (void)go { | |
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; | |
[request setURL:[NSURL URLWithString:@"http://httpbin.org/headers"]]; | |
[request setHTTPShouldHandleCookies:NO]; | |
[request setHTTPMethod:@"GET"]; | |
[request setValue:@"Test" forHTTPHeaderField:@"User-Agent"]; | |
[request setTimeoutInterval:10]; | |
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; | |
if (connection) { |
# $ pip install pygeoip | |
# $ pip install requests | |
# $ wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | |
# $ gunzip GeoIP.dat.gz | |
import pygeoip | |
import requests # Just for hiting httplib. | |
# Example or supported countries: | |
COUNTRIES = ('br', 'mx', 'cl', 'ar') |
# Download this example file first: | |
# http://podcast.cbc.ca/mp3/podcasts/spark_20130623_97794.mp3 | |
import cStringIO as StringIO | |
from PIL import Image | |
import eyed3 | |
audiofile = eyed3.load("spark_20130623_97794.mp3") | |
if len(audiofile.tag.images) > 0: |
# Handshake: (resolve the addressbook_path in order to cache it) | |
# Step 1: get [principal_path] from [server_root]: | |
$ curl -X PROPFIND --user [user]:[password] -H "Depth: 1" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><A:propfind xmlns:A=\"DAV:\"><A:prop><A:current-user-principal/></A:prop></A:propfind>" [server_root] | xpath "/d:multistatus/d:response[1]/d:propstat/d:prop/d:current-user-principal/d:href/text()" | |
# Step 2: get [addressbook_list_path] from [principal_path]: | |
$ curl -X PROPFIND --user [user]:[password] -H "Depth: 1" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><A:propfind xmlns:A=\"DAV:\"><A:prop><B:addressbook-home-set xmlns:B=\"urn:ietf:params:xml:ns:carddav\"/></A:prop></A:propfind>" [server_root][principal_path] | xpath "/d:multistatus/d:response[1]/d:propstat/d:prop/card:addressbook-home-set/d:href/text()" | |
# Step 3: get [addressbook_path] from [addressbook_list_path]: | |
$ curl -X PROPFIND --user [user]:[password] -H "Depth: 1" -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><A:propfind xml |
import json | |
from collections import OrderedDict | |
def serialize_with(collection_type): | |
complex_object = collection_type() | |
complex_object['z'] = collection_type() | |
complex_object['z']['c'] = 30 | |
complex_object['z']['b'] = 20 | |
complex_object['z']['a'] = 10 |
I hereby claim:
To claim this, I am signing this object:
import threading | |
import time | |
import random | |
class MyThread(threading.Thread): | |
def __init__(self, num): | |
self.num = num | |
threading.Thread.__init__(self) |