Skip to content

Instantly share code, notes, and snippets.

@comoc
comoc / file0.txt
Created March 9, 2017 04:16
findした結果をまとめてjqコマンドで処理する ref: http://qiita.com/comocc/items/0337c942988c3031194e
find . -name "*.json" -exec sh -c "jq < {}" \;
@comoc
comoc / file0.txt
Last active August 19, 2019 10:13
UnityからArduinoのデータをシリアル経由で取得したい!確かにArduinoからは出力しているはずなのに何もやって来ない。そんな時の対策 ref: https://qiita.com/comocc/items/43794313413091f23368
Serial.print("Hello");
Serial.println("");
@comoc
comoc / IntervalTimer.swift
Created June 16, 2016 13:31
An interval timer.
class IntervalTimer {
enum Status { case STARTED, STOPPED, PAUSED }
var duration: Float = 0.0
var startTime: Float = 0.0
var fraction: Float = 0.0
var isLoop: Bool = false
var status: Status = .STOPPED
@comoc
comoc / app.js
Last active April 13, 2016 10:12
nodeのchild_processのexecが失敗する時の対策 ref: http://qiita.com/comocc/items/9a2236d32d257a840ef5
var exec = require('child_process').exec;
exec('foo bar', {cwd: 'C:¥somewhare'}, function(error, stdout, stderr) {
if (error != null) {
console.log(error);
}
});
@comoc
comoc / file0.txt
Last active May 26, 2016 10:53
node+socket.io+expressでサーバーとWebページ間で通信するためのスニペット ref: http://qiita.com/comocc/items/70358fc8e17df7a15098
.
|-- index.html
|-- index.js
|-- node_modules
|-- package.json
@comoc
comoc / file0.js
Last active August 29, 2015 14:28
Google Maps APIで外部のKMLファイルを表示するときの注意点 ref: http://qiita.com/comocc/items/3fc93859cb3d1955398f
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 35.681269, lng: 41.876}
});
var ctaLayer = new google.maps.KmlLayer({
url: 'http://localhost/tokyost.kml', // NG
map: map
});
@comoc
comoc / gist:7539796
Last active October 3, 2017 15:23
[Unity] open a file dialog at runtime.

Here is very useful demo.

Take a look at this post.

Then downlowd and import Browser Demo Project.unitypackage.

You can receive a selection by implementing SendMessage, BroadcastMessage or something like that in Browser.cs.

@comoc
comoc / gist:7265141
Last active December 27, 2015 04:09
In OpenGL ES, the API specification of glDrawElements, type must be GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT.
As you can see in http://www.khronos.org/opengles/sdk/docs/man/xhtml/glDrawElements.xml
void glDrawElements( GLenum mode,
GLsizei count,
GLenum type,
const GLvoid * indices);
type
Specifies the type of the values in indices. Must be GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT.
@comoc
comoc / ClearCanvas.java
Created October 9, 2013 02:30
Clear the Canvas of a SurfaceView for Android.
// Obtain a SurfaceView.
// SurfaceView surfaceView = (SurfaceView)findViewById(R.id.surfaceView1);
Canvas canvas = surfaceView.getHolder().lockCanvas();
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
// Draw someting
surfaceView.getHolder().unlockCanvasAndPost(canvas);
@comoc
comoc / mtu_max_mac.sh
Created October 2, 2013 02:00
Inspect the maximum MTU value of your Mac. Please specify the IP value to your environment.
#!/usr/bin/env ruby
ruby -e 'IP="192.168.1.1"; puts "Progress..."; for i in 1454..1500 do; cmd="ping -D -c 1 -s " + i.to_s + " " + IP; s=`#{cmd} 2>&1`; if s.include?("100.0% packet loss") && !s.include?("too") then; puts IP + " was not found"; exit(1); elsif s.include?("too") then ; puts "Max MTU is " + (i - 1).to_s; exit(0) end; end'