Skip to content

Instantly share code, notes, and snippets.

View danpalmer's full-sized avatar

Dan Palmer danpalmer

View GitHub Profile
NSURLRequest *request = [NSURLRequest requestWithURL:someURL
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
dispatch_queue_t queue =
dispatch_queue_create("com.example.background", DISPATCH_QUEUE_CONCURRENT);
for (int i = 0; i < 50; i++) {
dispatch_async(queue, ^{
sleep(3);
NSLog(@"Block %d finished", i);
});
}
#!/bin/sh
ffmpeg -i source.mp4 -s hd720 -c:v libx264 -crf 23 -c:a libmp3lame -strict -2 source_converted.mp4
ffmpeg -i test_pattern.mp4 -s hd720 -c:v libx264 -crf 23 -c:a libmp3lame -strict -2 test_pattern_converted.mp4
mkdir segments
mkdir segments/source
mkdir segments/test_pattern
mediafilesegmenter --target-duration=10 -f segments/source source_converted.mp4 --no-floating-point-duration --iframe-index-file=none
mediafilesegmenter --target-duration=10 -f segments/test_pattern test_pattern_converted.mp4 --no-floating-point-duration --iframe-index-file=none
sudo easy_install pip
sudo pip install requests
sudo pip install requests-oauthlib
import requests
import math
import unicodecsv as csv
import time
from requests_oauthlib import OAuth1
APP_TOKEN = ''
APP_SECRET = ''
USER_TOKEN = ''
USER_SECRET = ''

Advice for Posting Job/Collaboration Offers

If you are not a Computer Science student, and are looking for someone to help you develop an app or website, for pay, equity or experience, have a quick look at these tips to get the best responses. People who follow these tips are much more likely to get the contacts they need to get their project off the ground.

1. Tell us your idea.

You don't need to go into detail, but a general hint, "change the way you search for products online" or "fun multiplayer 2D mobile game" is enough. We understand that you might be protective of an idea, but at the same time, we need something to get us interested.

2. What technology do you want to use?
import matplotlib.pyplot as plt
import numpy as np
input = open("stage2-input.bin", "rb").read()
bin = map(int, list(''.join(map(lambda s: s[2:], map(bin, map(ord, list(input)))))))
results = np.correlate(bin, bin, mode='full')
results = results[results.size/2:]
plt.plot(results[0:255])
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>https://thread.com</AllowedOrigin>
<AllowedOrigin>https://*.thread.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Content-*</AllowedHeader>
<AllowedHeader>Host</AllowedHeader>
</CORSRule>
import xmlrpclib
server = xmlrpclib.Server('http://magentohost/api/xmlrpc')
token = server.login('username', 'api_token')
def call(method, *args):
return server.call(token, method, *args)
print call('catalog_product.list', [{
'complex_filter': [{
def fib(n):
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return b