Skip to content

Instantly share code, notes, and snippets.

View shokai's full-sized avatar

Sho Hashimoto shokai

View GitHub Profile
@shokai
shokai / gist:70210
Created February 25, 2009 15:21
動かないsetInterval
serialInit(9600);
putTime(); // これは0って出る
setInterval(putTime, 10); // 実行されない
function putTime(){
serialSend(getTickCount()+"\r\n");
}
@shokai
shokai / gist:70482
Created February 25, 2009 22:38
アンモニアセンサ
pinMode(7, true);
serialInit(9600);
//setInterval(tick8ms, 100);
var count = 0;
function tick8ms(){
count++;
if(count%33 == 0) digitalWrite(7, true);
@shokai
shokai / favon_ldr.user.js
Created September 4, 2009 17:39
Fav on LDR
// ==UserScript==
// @name Favon LDR
// @namespace http://hoge.sub.jp/blog/
// @description add to twitter's favorites on LDR
// @include http://reader.livedoor.com/reader/*
// @include http://fastladder.com/reader/*
// @resource star http://assets0.twitter.com/images/icon_star_full.gif
// @version 0.0.3
// ==/UserScript==
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'mechanize'
require 'kconv'
puts url = ARGV.shift
agent = WWW::Mechanize.new
page = agent.get(url)
#include "mbed.h"
#include "HTTPClient.h"
#include <string>
using namespace std;
Serial pc(USBTX, USBRX);
DigitalOut led1(LED1); // blink
DigitalOut led2(LED2); // blink when http-post
DigitalOut led3(p11); // represent ADC value
// ==UserScript==
// @name gyazz_chrome_edit_fix.user.js
// @namespace http://shokai.org/
// @description insert newline when press enter key
// @include http://gyazz.com/*
// @version 0.1.4
// @author shokai
// ==/UserScript==
var executeBrowserContext = function(funcOrString) {
import javax.imageio.*;
import java.io.*;
import java.awt.image.*;
import java.awt.geom.*;
import java.awt.image.*;
class ImageResize{
public ImageResize(){
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>form set value</title>
<script type="text/javascript">
window.onload = function(){
document.getElementById("input_01").value = "test test test";
};
</script>
endtime = Time.local(2010, 7, 20, 16, 0, 0) # 2010年7月20日16時0分0秒
puts diff = endtime - Time.now
sec = diff
if sec >= 60
min = sec/60
sec = diff%60
end
if min and min >= 60
hour = min/60