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: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 / 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)
@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]
# -*- coding: utf-8
import RPi.GPIO as GPIO
import mosquitto
import sys
from datetime import datetime
PINS = (18, 23, 24, 25)
SERVER = "sample.example.com"
@basuke
basuke / gen-security.php
Created April 20, 2011 10:08
Generate CakePHP configuration value for security, Security.salt and Security.cipherSeed.
<?php
$salt = genrandom(40);
$seed = genrandom(29, "0123456789");
echo "\tConfigure::write('Security.salt', '$salt');\n";
echo "\tConfigure::write('Security.cipherSeed', '$seed');\n";
function genrandom($len, $salt = null) {
if (empty($salt)) {
@basuke
basuke / memorandum.md
Last active April 7, 2017 00:01
Policy Memorandum

Policy Memorandum

U.S. Citizenship and Immigration Services
Office of the Director (MS 2000)
Washington, DC  20529-2000

March 31, 2017
PM-602-0142

SUBJECT:

@basuke
basuke / Main.elm
Created January 29, 2018 05:11
Calc UI
module Main exposing (main)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main : Program Never Model Msg
main =
Html.beginnerProgram
{ model = 0