Skip to content

Instantly share code, notes, and snippets.

@taylanpince
taylanpince / iphone_checker.py
Created October 18, 2014 21:05
iPhone Availability Checker
import urllib2
import json
from twilio.rest import TwilioRestClient
EATON_STORE_CODE = "R121"
IPHONE6_SILVER_128_CODE = "MG3F2CL/A"
IPHONE6_GREY_128_CODE = "MG3E2CL/A"
APPLE_RESERVATION_URL = "https://reserve.cdn-apple.com/CA/en_CA/reserve/iPhone/availability.json"
@taylanpince
taylanpince / gist:28e483c2dc81f99e95aa
Created December 20, 2014 21:05
OV7670 Arduino UNO Simple Test
// OV7670+FIFO Simple Data Test
//
// OV7670 Arduino
// 3V3 3.3V
// GND GND
// SYNC 2
// D0-D7 6-13
//
void setup() {
@taylanpince
taylanpince / gist:01e701dca986648de364
Created December 21, 2014 13:32
Arduino OV7670 Port Register Integration
#include <avr/io.h>
#include <avr/interrupt.h>
static inline void serialWrB(uint8_t dat){
while(!( UCSR0A & (1<<UDRE0))); //wait for byte to transmit
UDR0=dat;
while(!( UCSR0A & (1<<UDRE0))); //wait for byte to transmit
}
static void StringPgm(char * str){
@taylanpince
taylanpince / gist:67e7bc40baba0a27b430
Created December 30, 2014 13:27
OVR7670 FIFO Read to Serial
#include <avr/io.h>
#include <avr/interrupt.h>
//
// RCLK 2
// VSYNC 3
// D0-D4 A0-A3
// D5-D8 4-7
// WE 8
// WRST 9
@taylanpince
taylanpince / gist:4c22a780080ed9923b69
Created January 1, 2015 23:11
OV7670 Arduino SPI
#include <Wire.h>
#include <SPI.h>
#define OV7670_address 0x21
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <HardwareSerial.h>
#include "SimpleI2C.h"
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
from lxml import etree
OSM_API_URL = "http://api.openstreetmap.org/api/0.6/map?bbox=%s"
def get_streets(bbox):
"""
Makes an OSM API request and parses the streets and their waypoints in the
XML response, returns a list
@taylanpince
taylanpince / gist:450551
Created June 23, 2010 21:01
Array.indexOf Support for IE
// Issue: IE doesn't support Array.indexOf (!)
// Solution: Use this
if (!Array.indexOf){
Array.prototype.indexOf = function(obj) {
for (var i = 0; i < this.length; i++) {
if (this[i] == obj) {
return i;
}
}
@taylanpince
taylanpince / PLBlocks and Xcode 4 Workaround
Created March 25, 2011 19:40
These symlinks allow Xcode 4 to work with the PLBlocks installer
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/GCC\ 4.2\ \(Plausible\ Blocks\ -\ iPhoneOS\).xcplugin
cd /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
sudo ln -s /Developer/Library/Xcode/Plug-ins/GCC\ 4.2\ \(Plausible\ Blocks\).xcplugin
@taylanpince
taylanpince / gist:1052154
Created June 28, 2011 20:43
blogTO Best of Title Shortener
NSString *trimmedTitle = [self.entryTitle stringByReplacingOccurrencesOfString:@"The Best"
withString:@""
options:NSCaseInsensitiveSearch
range:NSMakeRange(0, [self.entryTitle length])];
trimmedTitle = [trimmedTitle stringByReplacingOccurrencesOfString:@"in Toronto"
withString:@""
options:NSCaseInsensitiveSearch
range:NSMakeRange(0, [trimmedTitle length])];