Skip to content

Instantly share code, notes, and snippets.

View cho45's full-sized avatar

Satoh, Hiroh cho45

View GitHub Profile
/* UCJS Loader
* cho45, 2007-01-24 (Add menuitem for reloading)
* nanto_vi (TOYAMA Nao), 2006-12-20
*
* Automatically includes all files ending in .uc.js
* from the profile's chrome folder
*
* Original Author: zeniko
* Original Extension: Sub-Script Loader (a user script for userChrome.js)
* <http://forums.mozillazine.org/viewtopic.php?t=397735#2169699>
@cho45
cho45 / fetch-video.pl
Created November 23, 2008 18:21
時報うぜぇwwwww
#!/usr/bin/perl
# original: http://search.cpan.org/src/MIYAGAWA/WWW-NicoVideo-Download-0.01/eg/fetch-video.pl
use strict;
use WWW::NicoVideo::Download;
use Term::ProgressBar;
use Config::Pit;
use URI;
use HTML::TreeBuilder::XPath;
use Perl6::Say;
// 正規分布の累積分布関数生成関数
function make_normal_distribution_function (variance, average) {
var a = Math.sqrt(variance) * Math.sqrt(2);
var erf = function (x) {
return ((x < 0.0) ? -1 : 1) * Math.pow(1.0 - Math.exp(-1.27323954 * x * x), 0.5);
};
return function (x) {
return (1 + erf((x - average) / a)) / 2;
};
data:audio/ogg;base64,
T2dnUwACAAAAAAAAAAB9jS1hAAAAAEE8b8gBHgF2b3JiaXMAAAAAAkSsAAAA
AAAAAHECAAAAAAC4AU9nZ1MAAAAAAAAAAAAAfY0tYQEAAABHP9bQES3/////
////////////////A3ZvcmJpcx0AAABYaXBoLk9yZyBsaWJWb3JiaXMgSSAy
MDA3MDYyMgAAAAABBXZvcmJpcylCQ1YBAAgAAAAxTCDFgNCQVQAAEAAAYCQp
DpNmSSmllKEoeZiUSEkppZTFMImYlInFGGOMMcYYY4wxxhhjjCA0ZBUAAAQA
gCgJjqPmSWrOOWcYJ45yoDlpTjinIAeKUeA5CcL1JmNuprSma27OKSUIDVkF
AAACAEBIIYUUUkghhRRiiCGGGGKIIYcccsghp5xyCiqooIIKMsggg0wy6aST
TjrpqKOOOuootNBCCy200kpMMdVWY669Bl18c84555xzzjnnnHPOCUJDVgEA
IAAABEIGGWQQQgghhRRSiCmmmHIKMsiA0JBVAAAgAIAAAAAAR5EUSbEUy7Ec
@cho45
cho45 / swapspeed.ahk
Created December 27, 2008 07:15
swapmouse speed
; ref. http://www.autohotkey.com/forum/topic9593.html
SPI_GETMOUSESPEED = 0x0070
SPI_SETMOUSESPEED = 0x0071
MySpeed = 14 ; A number between 1-20.
DllCall("SystemParametersInfo", UInt, SPI_GETMOUSESPEED, UInt, 0, UIntP, CurrentSpeed, UInt, 0)
; MsgBox,%CurrentSpeed%
If (CurrentSpeed > 10) {
#!/usr/bin/env ruby -Ku
require "rubygems"
require "RMagick"
require "pathname"
require "ostruct"
file, size, = *ARGV
function duration (str) {
var ret = 0, units = arguments.callee.units;
str.replace(/(\d+)\s*(msec|sec|min|hour|day|week|month|year)s?/g, function (_, num, unit) {
ret += +num * units[unit];
});
return ret * 1000;
}
duration.units = {
sec : 1, min : 60, hour : 3600, day : 86400, week : 604800, month : 2592000, year : 31536000
};
@cho45
cho45 / c.c
Created January 18, 2009 20:15
//#!gcc -g -O0 -Wall c.c && ./a.out #
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@cho45
cho45 / createHTMLDocument.js
Created January 20, 2009 12:43
createHTMLDocument
function createHTMLDocument (title) {
// Firefox doesn't have createHTMLDocument
if (!document.implementation.createHTMLDocument) {
// Maybe this is the best way to create HTMLDocument, but not worked in any browser...
// var html4dt = document.implementation.createDocumentType("HTML", "-//W3C//DTD HTML 4.01//EN", "http://www.w3.org/TR/html4/strict.dtd");
// var d = document.implementation.createDocument("", "HTML", html4dt);
// return d;
// In Firefox
// Try to create HTMLDocument from XSLT with <xsl:output method='html'/>
// ==UserScript==
// @name Hatena: Ignore Ids
// @description Remove the id from our world.
// @namespace http://lowreal.net/
// @include http://d.hatena.ne.jp/*
// @include http://h.hatena.ne.jp/*
// @include http://h1beta.hatena.ne.jp/*
// @include http://b.hatena.ne.jp/*
// @include http://q.hatena.ne.jp/*
// @require http://svn.coderepos.org/share/lang/javascript/jsdeferred/trunk/jsdeferred.userscript.js