This gist accompanies the blog post Building NSURL Queries with NSURLQueryItems and NSURLComponents.
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
rtl-sdr build notes for OSX | |
using macports http://www.macports.org/ | |
see http://sdr.osmocom.org/trac/wiki/rtl-sdr | |
brew install cmake | |
brew install libusb | |
brew install pkgconfig | |
brew install sox # for easy audio | |
git clone git://git.osmocom.org/rtl-sdr.git | |
cd rtl-sdr/ |
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
@interface ALAssetsLibrary (VideoOrientation) | |
+ (UIInterfaceOrientation)orientationForTrack:(AVAsset *)asset; | |
@end |
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
#! /bin/bash | |
# | |
# Diffusion youtube avec ffmpeg | |
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée. | |
VBR="2500k" # Bitrate de la vidéo en sortie | |
FPS="30" # FPS de la vidéo en sortie | |
QUAL="medium" # Preset de qualité FFMPEG | |
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube |
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
// URL of the endpoint we're going to contact. | |
NSURL *url = [NSURL URLWithString:@"http://localhost:8080/my.json"]; | |
// Create a simple dictionary with numbers. | |
NSDictionary *dictionary = @{ @"numbers" : @[@1, @2, @3] }; | |
// Convert the dictionary into JSON data. | |
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:dictionary | |
options:0 | |
error:nil]; |
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
import sqlalchemy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, relationship | |
engine = sqlalchemy.create_engine('sqlite:///:memory:') | |
Base = declarative_base() | |
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
# Video of it in action: http://cl.ly/VSIF | |
class MyScene < SKScene | |
def scroll_action(x, duration) | |
width = (x * 2) | |
move = SKAction.moveByX(-width, y: 0, duration: duration * width) | |
reset = SKAction.moveByX(width, y: 0, duration: 0) | |
SKAction.repeatActionForever(SKAction.sequence([move, reset])) | |
end |
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
# DUBSTEP | |
# Combines ideas from my other gists | |
current_bpm = 140.0 | |
use_bpm current_bpm | |
# WOBBLE BASS | |
define :wob do | |
use_synth :dsaw | |
lowcut = note(:E1) # ~ 40Hz | |
highcut = note(:G8) # ~ 3000Hz |
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
import AVFoundation | |
import Foundation | |
// The maximum number of audio buffers in flight. Setting to two allows one | |
// buffer to be played while the next is being written. | |
private let kInFlightAudioBuffers: Int = 2 | |
// The number of audio samples per buffer. A lower value reduces latency for | |
// changes but requires more processing but increases the risk of being unable | |
// to fill the buffers in time. A setting of 1024 represents about 23ms of |
TL;DR
Create a backup:
pg_dumpall > mybackup.sql
Perform the upgrade:
sudo pg_dropcluster 9.4 main --stop