Skip to content

Instantly share code, notes, and snippets.

View basuke's full-sized avatar
🍺
beer

Basuke Suzuki basuke

🍺
beer
View GitHub Profile
@basuke
basuke / gist:1273194
Last active April 29, 2023 14:38
sharedObject
We couldn’t find that file to show.
@basuke
basuke / gist:1273222
Created October 9, 2011 03:08
UUIDのNSString生成
+ (NSString *)stringWithGUID {
CFUUIDRef uuid = CFUUIDCreate(nil);
NSString *str = (NSString*)CFUUIDCreateString(nil, uuid);
CFRelease(uuid);
return [str autorelease];
}
@basuke
basuke / gist:1363403
Created November 14, 2011 06:48
NSIndexPathの比較テストの検証
- (void)testIndexPathEquality {
NSIndexPath *ip1 = [NSIndexPath indexPathForRow:0 inSection:0];
NSIndexPath *ip2 = [NSIndexPath indexPathForRow:0 inSection:0];
STAssertTrue([ip1 isEqual:ip2], @"indexpath の比較");
}
@basuke
basuke / sample.applescript
Created July 20, 2012 16:00
file access sample
set t to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set t to t & t & t & t & t & t & t & t
set t to t & t & t & t & t & t & t & t
set t to t & t & t & t & t & t & t & t
set t to t & t & t & t & t & t & t & t
set t to t & t & t & t & t & t & t & t
set t to t & t & t & t & t & t & t & t
set thePath to choose file name default name "stupid big data" default location (path to temporary items)
@basuke
basuke / drive.py
Created September 2, 2012 22:49
Create the GPX file from origin and destination using the GoogleMap Direction API. You can use this output for simulate the location apps in Xcode.
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser
@basuke
basuke / NSObject+BasukeAddition.h
Created October 18, 2012 19:01
To suppress the LLVM's "PerformSelector may cause a leak because its selector is unknown" warning...
#import <Foundation/Foundation.h>
@interface NSObject(BasukeAddition)
- (id)performSelectorIfExists:(SEL)aSelector;
- (id)performSelectorIfExists:(SEL)aSelector withObject:(id)object;
- (id)performSelectorIfExists:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
@end
@basuke
basuke / tilt-test.py
Last active December 15, 2015 22:29
Raspberry Pi with Tilt sensor test. http://www.youtube.com/watch?v=IkuUMund6rA
import pygame.mixer
from time import sleep
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.IN)
print "Ready."
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
We couldn’t find that file to show.
@basuke
basuke / tilt3.py
Created April 28, 2013 04:44
Raspberry Pi Kitchen Range Monitor using GPIO
from time import sleep
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
pins = [18,23,24,25]
[GPIO.setup(pin, GPIO.IN) for pin in pins]