Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@laclefyoshi
laclefyoshi / translator.hs
Created October 16, 2010 05:29
A Command-line Tool for Google Translate
-- A Command-line Tool for Google Translate
-- Copyright : (c) SAEKI Yoshiyasu
-- License : MIT-style license <http://www.opensource.org/licenses/mit-license.php>
-- last updated: 2010/10/16
import Network.URI
import Data.List
import Network.HTTP
import Text.JSON
import System
@laclefyoshi
laclefyoshi / websocket_devicemotion_ios.html
Created November 26, 2010 13:22
WebSocket and DeviceMotion Event for iOS Safari
<!DOCTYPE html>
<html lang="jp" xml:lang="jp">
<head>
<meta charset="utf-8">
<title>Balls</title>
<style>
.ball {
position: absolute;
top: 0px;
left: 0px;
@laclefyoshi
laclefyoshi / websocket_server.py
Created November 26, 2010 13:25
WebSocket server with Tornado
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright : (c) SAEKI Yoshiyasu
# License : MIT-style license
# <http://www.opensource.org/licenses/mit-license.php>
# last updated: 2010/11/25
import tornado.httpserver
import tornado.ioloop
import tornado.web
@laclefyoshi
laclefyoshi / balls_websocket.py
Created December 4, 2010 01:02
WebSocket Server for connecting iPod touch and Arduino
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright : (c) SAEKI Yoshiyasu
# License : MIT-style license
# <http://www.opensource.org/licenses/mit-license.php>
# last updated: 2010/12/03
import tornado.httpserver
import tornado.ioloop
import tornado.web
@laclefyoshi
laclefyoshi / gist:727799
Created December 4, 2010 01:07
Arduino code using aJson, Matrix and Ethernet
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2010/12/03
**/
#include <SPI.h>
#include <Ethernet.h>
#include <aJSON.h>
@laclefyoshi
laclefyoshi / balls_canvas.html
Created December 4, 2010 01:08
Web page using WebSocket and DeviceMotion Event
<!DOCTYPE html>
<html lang="jp" xml:lang="jp">
<head>
<meta charset="utf-8">
<title>Balls</title>
<style>
.ball {
position: absolute;
top: 0px;
left: 0px;
@laclefyoshi
laclefyoshi / pyinotify_test.py
Created December 11, 2010 05:54
script using pyinotify
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright : (c) SAEKI Yoshiyasu
# License : MIT-style license
# <http://www.opensource.org/licenses/mit-license.php>
# last updated: 2010/12/11
import pyinotify
@laclefyoshi
laclefyoshi / pyinotify.txt
Created December 11, 2010 06:25
using pyinotify
$ python -m pyinotify TARGET_DIR
## ls
<event dir="True" mask="0x40000020" maskname="IN_OPEN|IN_ISDIR" name="" path="TARGET_DIR" pathname="/home/saeki/TARGET_DIR" wd="1">
<event dir="True" mask="0x40000010" maskname="IN_CLOSE_NOWRITE|IN_ISDIR" name="" path="TARGET_DIR" pathname="/home/saeki/TARGET_DIR" wd="1">
## touch test1
<event dir="False" mask="0x100" maskname="IN_CREATE" name="test1" path="TARGET_DIR" pathname="/home/saeki/TARGET_DIR/test1" wd="1">
<event dir="False" mask="0x20" maskname="IN_OPEN" name="test1" path="TARGET_DIR" pathname="/home/saeki/TARGET_DIR/test1" wd="1">
<event dir="False" mask="0x4" maskname="IN_ATTRIB" name="test1" path="TARGET_DIR" pathname="/home/saeki/TARGET_DIR/test1" wd="1">
@laclefyoshi
laclefyoshi / gist:744925
Created December 17, 2010 13:26
Arduino code for posting messages to im.kayac.com
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2010/12/03
**/
#include <SPI.h>
#include <Ethernet.h>
#include <string.h>
@laclefyoshi
laclefyoshi / gist:754682
Created December 25, 2010 04:29
Arduino code for controlling GLCD through Serial port
/**
Copyright: (c) SAEKI Yoshiyasu
License : MIT-style license
<http://www.opensource.org/licenses/mit-license.php>
last updated: 2010/12/24
**/
#include <ks0108.h>
int inByte = 0;