Skip to content

Instantly share code, notes, and snippets.

@laclefyoshi
laclefyoshi / translator.hs
Created Oct 16, 2010
A Command-line Tool for Google Translate
View translator.hs
-- 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 Nov 26, 2010
WebSocket and DeviceMotion Event for iOS Safari
View websocket_devicemotion_ios.html
<!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 Nov 26, 2010
WebSocket server with Tornado
View websocket_server.py
#!/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 Dec 4, 2010
WebSocket Server for connecting iPod touch and Arduino
View balls_websocket.py
#!/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 Dec 4, 2010
Arduino code using aJson, Matrix and Ethernet
View gist:727799
/**
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 Dec 4, 2010
Web page using WebSocket and DeviceMotion Event
View balls_canvas.html
<!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 Dec 11, 2010
script using pyinotify
View pyinotify_test.py
#!/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
View pyinotify.txt
$ 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 Dec 17, 2010
Arduino code for posting messages to im.kayac.com
View gist:744925
/**
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 Dec 25, 2010
Arduino code for controlling GLCD through Serial port
View gist:754682
/**
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;