Skip to content

Instantly share code, notes, and snippets.

@yoggy
yoggy / sensor_bot.coffee
Created June 10, 2014 07:52
Hubotのスクリプトを作ってみたテスト
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.respond /nike$/i, (msg) ->
msg.send 'https://farm8.staticflickr.com/7118/7446163748_fd8ace754f_m.jpg'
robot.respond /sensor$/i, (msg) ->
output = ''
ls = spawn('./sensor.rb')
ls.stdout.on 'data', (data) ->
import fisica.*;
FWorld world;
void setup() {
size(400, 400);
smooth();
Fisica.init(this);
//
// mqtt_pub_dht11.ino - mqtt publish sample for Arduino Ethernet
//
// This program uses the following libraries.
// https://github.com/knolleary/pubsubclient
// https://github.com/virtuabotix/DHT11LIB
//
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
@yoggy
yoggy / mqtt_influxdb_sample.rb
Last active August 29, 2015 14:02
mqtt & influxdb sample..
#!/usr/bin/ruby
# -*- encoding: utf-8 -*-
#
# mqtt & influxdb sample...
#
# libraries
# $ gem install mqtt
# $ gem install influxdb
#
#!/bin/ruby
# -*- encoding: utf-8 -*-
#
# $ gem install mqtt
#
require 'rubygems'
require 'mqtt'
require 'uri'
@yoggy
yoggy / find_af1.rb
Last active August 29, 2015 14:00
find_af1.rb - ものすごく雑なエアフォースワンが飛んでるかどうか探すスクリプト。参考URL→ http://theaviationist.com/2011/11/24/af1-adsb/
#!/usr/bin/ruby
require 'open-uri'
require 'json'
require 'logger'
$url = "http://db8.flightradar24.com/zones/japan_all.js"
$log = Logger.new(STDOUT)
def is_found_af1
@yoggy
yoggy / CreateCylinderMesh.cs
Last active August 29, 2015 13:57
save to "Assets/Editor" directory
using UnityEditor;
using UnityEngine;
using System.Collections;
public class CreateCylinderMesh : MonoBehaviour {
static int div_x = 40;
static int div_y = 20;
static float cylinder_width = 10.0f;
static float cylinder_height = 5.0f;
using UnityEngine;
using System.Collections;
public class httptexture : MonoBehaviour {
private Texture2D tex2d;
private delegate void WWWAction (WWW www);
void Start () {
@yoggy
yoggy / convert_to_date.pde
Last active August 29, 2015 13:57
convert System.currentTimeMillis() to java.utils.Date object.
import java.util.*;
void setup() {
long t_start = 1393640607018L;
long t_1130 = 1393641000000L;
long t_1200 = 1393642800000L;
long t_1230 = 1393644600000L;
long t_1300 = 1393646400000L;
#!/usr/bin/ruby
#
# trim.rb - trim sensor & scenario log
#
def usage
puts <<-EOS
usage : ./trim_log.rb [start_time] [end_time] [file]"
example: