Skip to content

Instantly share code, notes, and snippets.

View Lewuathe's full-sized avatar
🈂️
👍

Kai Sasaki Lewuathe

🈂️
👍
View GitHub Profile
@Lewuathe
Lewuathe / file0.txt
Created January 23, 2013 12:48
configファイルの作り方 ref: http://qiita.com/items/e817658ad29c210a10af
config = {
"A":"a",
"B":"b",
"C":"c"
}
config = '¥n'.join(map('='.join, config.iteritems())
# config= "A=a¥nB=b¥nC=c"
@Lewuathe
Lewuathe / file0.txt
Created January 23, 2013 13:04
optparseモジュールの使い方 ref: http://qiita.com/items/203a2896f707730f1c28
# まずモジュールのインポート
import optparse
# parserのメインオブジェクトの作成
parser = optparse.OptionParser()
# 各オプションの設定追加
# この場合だと--debug引数を与えると後で取得する
# optionsオブジェクトのdebugプロパティがTrueになる
# helpは--helpを与えたときに各オプションで表示される
@Lewuathe
Lewuathe / file0.txt
Created January 29, 2013 13:19
Express3.xでejsをインストールする方法 ref: http://qiita.com/items/36309642538c3ec42e04
express sample -t ejs
@Lewuathe
Lewuathe / file0.txt
Created January 31, 2013 13:17
Three.jsでテクスチャを貼付ける方法1 ref: http://qiita.com/items/a1e40ba95c8a26fa3112
var material = new THREE.MeshBasicMaterial( {
color: 0x00ff00,
wireframe: true ,
map : THREE.ImageUtils.loadTexture('/images/image.png')} );
@Lewuathe
Lewuathe / file0.txt
Created February 2, 2013 04:36
Githubで空のディレクトリを管理する方法 ref: http://qiita.com/items/37a27cb5f2062e823147
cd /emptyDir
touch .gitkeep
@Lewuathe
Lewuathe / file0.txt
Created February 3, 2013 07:18
Three.jsでカーソルとの衝突判定する方法 ref: http://qiita.com/items/9107051360c2683b2520
var projector = new THREE.Projector();
var mouseX = e.clientX -getElementPosition(renderer.domElement).left;
var mouseY = e.clientY - getElementPosition(renderer.domElement).top;
var x = (mouseX / renderer.domElement.width) * 2 - 1;
var y = -(mouseY/renderer.domElement.height) * 2 + 1;
var vector = new THREE.Vector3(x, y, 1);
projector.unprojectVector(vector, camera);
var net = require('net');
var socket = new net.Socket();
socket.on('close',function(){
console.log('close');
process.nextTick(function(){
socket.connect(80, "www.google.com");
});
});
ioctl(fd, FIOCLEX, NULL)
= fcntl(fildes, F_SETFD, FD_CLOEXEC)
ioctl(fd, FIONCLEX, NULL)
= fcntl(fildes, F_SETFD, 0)
@Lewuathe
Lewuathe / file0.txt
Created February 7, 2013 12:58
[const char*] with const_cast<char*> ref: http://qiita.com/items/3e30a87e82fda3d015b6
char **params;
params = new char*[paramNum];
params[0] = const_cast<char*>("param1");
params[1] = const_cast<char*>("param2");
@Lewuathe
Lewuathe / file0.txt
Created February 10, 2013 15:02
Confirm booting of Beagleboard-xM ref: http://qiita.com/items/6ffc24fe77358da3b60b
$ ls /dev/tty.usb*
/dev/tty.usbserial-00001014