Skip to content

Instantly share code, notes, and snippets.

View hatone's full-sized avatar
🦋
Think deep, work hard.

Takako Ohshima hatone

🦋
Think deep, work hard.
View GitHub Profile
@hatone
hatone / ArduinoSide.c
Created February 11, 2012 07:58
Arduino+Ruby
int incomingByte = 0;
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
#include <Wire.h>
#define MPU6050_ACCEL_XOUT_H 0x3B // R
#define MPU6050_WHO_AM_I 0x75 // R
#define MPU6050_PWR_MGMT_1 0x6B // R/W
#define MPU6050_I2C_ADDRESS 0x68
typedef union accel_t_gyro_union{
struct{
uint8_t x_accel_h;
@hatone
hatone / gist:9187637
Last active August 29, 2015 13:56
あれに何かを書き込むための何か
var str0 = '{"id":0,"name":"GMT","difference":0}';
var str1 = '{"id":1,"name":"JST","difference":9}';
var str2 = '{"id":2,"name":"PST","difference":-8}';
timezones = new Array(JSON.parse(str1), JSON.parse(str2), JSON.parse(str0));
localStorage.setItem("currentTimezone",JSON.stringify(timezones[0]));
localStorage.setItem("myTimezone",JSON.stringify(timezones));
@hatone
hatone / BoundingBox.java
Created February 7, 2014 01:30
SRM607 DIV2 250
public class BoundingBox {
public int smallestArea(int[] X, int[] Y) {
return getl(X)*getl(Y);
}
private int getl(int[] N) {
int max = -100;
int min = 100;