Skip to content

Instantly share code, notes, and snippets.

@hideyukisaito
hideyukisaito / osc4node_example.js
Created January 14, 2012 04:15
osc4node and express example
var express = require('express')
, osc = require('osc4node')
, app = express.createServer()
, port = process.env.PORT || 3000;
app.configure(function() {
app.use(app.router);
});
app.get('/', function(req, res) {
@hideyukisaito
hideyukisaito / get_friend_images.rb
Created March 30, 2014 13:32
Facebook から友人のプロフィール画像をぶっこぬく
#encoding: utf-8
require 'rubygems'
require 'open-uri'
require 'koala'
access_token = 'my_holy_token'
@graph = Koala::Facebook::API.new(access_token)
@hideyukisaito
hideyukisaito / file0.applescript
Created August 27, 2015 07:15
Finder で指定したフォルダをルートとしてローカルサーバを起動する ref: http://qiita.com/hideyukisaito/items/03c46c075151947f3569
on run {argv}
display dialog "Enter port number" default answer "8888"
set targetPort to text returned of result
tell application "Terminal"
set currentTab to do script "cd " & (argv)'s POSIX path
delay 1
do script "php -S localhost:" & targetPort in currentTab
end tell
end run
#include "ofMain.h"
class ofApp : public ofBaseApp
{
public:
ofMesh mesh, ellipse;
double scale = 200.0;
//--------------------------------------------------------------
ofVbo mHemisphere;
void ofApp::setup()
{
const auto resolution_ = 256;
const auto radius_ = 100.0;
std::vector<ofVec3f> vertices_;
for (auto i = 0; i < resolution_; ++i)
#include <iostream>
auto main() -> int
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *basePath = [NSURL URLWithString:@"path/to/directory"];
NSFileManager *fm = [NSFileManager defaultManager];
NSArray<NSString *> *files = [fm contentsOfDirectoryAtPath:[basePath absoluteString] error:nil];
@hideyukisaito
hideyukisaito / ofxEdsdk_crashed_at_init.txt
Last active April 1, 2016 11:50
Crashed at Eds::InitializeSDK
2016-04-01 20:45:42.106 exampleDebug[60445:27200058] -[__NSTaggedDate _cfurl]: unrecognized selector sent to instance 0x4d
2016-04-01 20:45:42.107 exampleDebug[60445:27200058] An uncaught exception was raised
2016-04-01 20:45:42.107 exampleDebug[60445:27200058] -[__NSTaggedDate _cfurl]: unrecognized selector sent to instance 0x4d
2016-04-01 20:45:42.107 exampleDebug[60445:27200058] (
0 CoreFoundation 0x00007fff8ffb7ae2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff89d5af7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8ffbab9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8fef3601 ___forwarding___ + 1009
4 CoreFoundation 0x00007fff8fef3188 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00007fff8feb0749 CFURLCreateCopyAppendingPathComponent + 137
[verbose] ofxEdsdk::setup: connected camera model: Canon EOS 5D Mark III 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_Evf_OutputDevice / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_Evf_OutputDevice / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_AEBracket / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_AEMode / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_AFMode / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_DriveMode / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_MeteringMode / 0
[verbose] property event kEdsPropertyEvent_PropertyChanged: kEdsPropID_WhiteBalance / 0
# -*- coding: utf-8 -*-
import numpy as np
import cv2
import math
def main():
img = cv2.imread('images/sample_8.jpg')
height, width, channels = img.shape
# -*- coding: utf-8 -*-
import numpy as np
import cv2
import math
def rgb_to_hsv(r, g, b):
hsv = cv2.cvtColor(np.array([[[b, g, r]]], dtype=np.uint8), cv2.COLOR_BGR2HSV)[0][0]
return (hsv[0], hsv[1], hsv[2])