Skip to content

Instantly share code, notes, and snippets.

Avatar
🍣
🍣

Tomohito Ozaki yuroyoro

🍣
🍣
View GitHub Profile
View gist:91676
getCurPosition_ie = function(id){
var elm = document.getElementById(id);
var docRange = document.selection.createRange();
var textRange = document.body.createTextRange();
textRange.moveToElementText(elm);
var range = textRange.duplicate();
range.setEndPoint("EndToStart", docRange);
var start = range.text.length;
return start;
View gist:100995
import scala.actors._
import java.lang.Thread
import java.net.{Authenticator, PasswordAuthentication}
import java.net.{URL, HttpURLConnection,URLEncoder}
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.Calendar
import scala.xml.XML
View gist:104440
# -*- coding: utf-8 -*-
#
# Yaruo AA macro for Trac 0.11
#
# Author : Yuroyoro
# License: BSD
from trac.core import *
from trac.util.html import Markup
from trac.wiki.macros import WikiMacroBase
View gist:108617
class Bar(object):
def __init__(self,p1,p2):
self.p1 = p1
self.p2 = p2
def val(self):
return (self.p1,self.p2)
def __lt__( self, other):
return self.val() < other.val()
View priority_queue.py
# -*- coding: utf-8 -*-
#
class PriorityQueue(object):
def __init__(self):
self._queue = []
def push( self, obj , priority=0):
self._queue.append( (obj, priority) )
return self
View 美人時計ダウンロードスクリプト scala
import java.net.{URL,HttpURLConnection}
import java.io._
object BijintDownloader extends Application{
for( hour <- 0 to 23; minute <- 0 to 59){
val fname = "%02d%02d.jpg".format( hour,minute )
val url = "http://bijint.com/jp/img/clk/%s".format( fname )
val urlConn = new URL(url).openConnection.asInstanceOf[HttpURLConnection]
urlConn.addRequestProperty("REFERER","http://bijint.com/jp/")
View JJUG CCC カメラキャプチャと顔認識
/**
* (./) FaceDetection.java, 03/05/08
* (by) cousot stephane @ http://www.ubaa.net/
* (cc) some right reserved
*
* Sample program for "OpenCV" project.
* Use ESC key to close the program properly.
*
* This sample is released under a Creative Commons Attribution 3.0 License
* 腦駈醜 http://creativecommons.org/licenses/by/3.0/ 腦駈什
View JJUG CCC アニメ顔認識.java
import java.awt.*;
import java.awt.image.MemoryImageSource;
import hypermedia.video.OpenCV;
public class AnimeFaceDetection extends Frame {
OpenCV cv = null;
AnimeFaceDetection(String imagePath) {
super();
View LDRFeedSummary.scala
import scala.xml._
import scala.io.Source
object LDRFeedSummary {
val opmlUrl = "http://reader.livedoor.com/user/%s/opml"
val r = """http\:\/\/([^\/]+)\/.*$""".r
// まとめるドメイン
val topLevelDomain = List("fc2.com",
View LDRの購読数をドメイン毎に集計する.scala
import java.lang.{String ⇒ 文字列}
import scala.{Int ⇒ 整数 , Double ⇒ 倍精度浮動小数点}
import scala.{List ⇒ リスト, Array ⇒ 配列}
import scala.xml.{XML ⇒ XMLオブジェクト, NodeSeq ⇒ ノードリスト}
import scala.io.{Source ⇒ ソース}
import scala.collection.immutable.{Map ⇒ マップ}
object LDRの購読数をドメイン毎に集計する{
val opmlの場所= "http://reader.livedoor.com/user/%s/opml"