This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gikuSmooth(arr,length,T){ | |
var K=10/3/T; | |
var data=[]; | |
var xmap={}; | |
for(var i=0;i<arr.length;i++){ | |
var obj=arr[i]; | |
var x,v; | |
if(obj.length){x=obj[0].length;v=obj[1];} | |
else{x=obj/length;v=1;} | |
if(xmap[x])xmap[x].v+=v; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cnt=0; | |
function killAds(){ | |
var units=document.getElementsByClassName("ego_unit"); | |
try{selectAll()}catch(e){} | |
for(var i=0;i<units.length;i++){ | |
if(units[i].innerHTML.match("広告"))try{findDisableButton(units[i])}catch(e){} | |
} | |
for(var i=0;i<units.length;i++){ | |
var unit=units[i] | |
if(unit.innerHTML.match("さんが"))continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'socket' | |
require 'digest' | |
class GrowlUDP | |
attr_accessor :app, :password, :types | |
def initialize op | |
self.app = op[:app] | |
self.password = op[:password] | |
self.types = op[:types] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=gets.to_i/2 | |
a=-n..n | |
a.map{|y|puts a.map{|x|"%#{4-21/(n+6)}d".%2*[2*y*y-y,2*x*x-x-z=(x-y).abs].max-~z}*' '} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
class Te | |
attr_accessor :te_num | |
def initialize num=nil | |
self.te_num = num ? num % 3 : rand(3) | |
end | |
def > te | |
(te_num + 1) % 3 == te.te_num |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var http = require('http'); | |
var cpus = require('os').cpus().length; | |
var app = express(); | |
var net = require('net'); | |
var cluster = require('cluster'); | |
var socketio=require('socket.io'); | |
var httpport = 4567; | |
var curlport = 5678; | |
process.on('uncaughtException',function(err){}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//g++ -framework ApplicationServices ls2sl.cc | |
//enable [System Preferences -> Universal Access -> Access for assistive devices] | |
#include <stdio.h> | |
#include <ApplicationServices/ApplicationServices.h> | |
#include <sys/time.h> | |
#define BUFSIZE 100 | |
int keyBuffer[BUFSIZE]; | |
struct timeval timeBuffer[BUFSIZE]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BezierConverter={} | |
BezierConverter.BSearch=function(min,max){ | |
if(min==undefined)min=0; | |
if(max==undefined)max=Infinity; | |
this.index=min; | |
this.ok=min-1; | |
this.ng=null; | |
this.result=function(result){ | |
if(result)this.ok=this.index; | |
else this.ng=this.index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var server=require('webserver').create(); | |
var webpage=require('webpage'); | |
var fs=require('fs'); | |
var service=server.listen(8080,function(request,response){ | |
var queryIndex=request.url.indexOf("?"); | |
var params={}; | |
if(queryIndex>=0){ | |
var queries=request.url.substr(queryIndex+1).split('&'); | |
for(var i=0;i<queries.length;i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby | |
def method_missing name, *args | |
n, a = name.to_s.chars.first, *args | |
return n + a.to_s if n.downcase == n || n.respond_to?(n) | |
String.class_eval{define_method(n){a.size - n.size}} | |
print n + a + (a.reverse.ord - n.ord - a.hex / n.send(n) - n.send(n)).chr | |
end | |
H H eeee l l oo | |
H H e l l o o |