Skip to content

Instantly share code, notes, and snippets.

@cou929
cou929 / tcget.py
Created August 8, 2010 14:06
Fetch TopCoder problem statement, test cases and expected result of system test. And save these data to file.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
tcget.py
Kosei Moriyama <cou929@gmail.com>
'''
import BeautifulSoup
@cou929
cou929 / mt_to_markdown.rb
Created August 6, 2017 04:16 — forked from code-later/mt_to_markdown.rb
Convert a MovableType export to single Markdown posts to use with Octopress
#!/usr/bin/env ruby
require 'date'
require 'mustache'
require 'stringex'
require 'cgi'
require 'fileutils'
export = File.open(ARGV[0])
target_dir = ARGV[1]
@cou929
cou929 / image_onload_test.html
Created December 25, 2013 12:59
test for setting timing of onload event listener
<!DOCTYPE html>
<html>
<head>
<script>
// for caching
(new Image()).src = 'http://upload.wikimedia.org/wikipedia/commons/2/23/1x1.GIF?a=1';
</script>
</head>
<body>
<div>
@cou929
cou929 / index.html
Last active December 30, 2015 18:48
Study of cookie domain limitation of each major browsers.
<!DOCTYPE html>
<head>
<title>Cookie restriction tester</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="tester.js"></script>
</head>
<body>
<div id="max_cookie_count_per_domain"></div>
<div id="max_cookie_count_per_domain_warning"></div>
<div id="ext"></div>
@cou929
cou929 / sample.html
Last active December 29, 2015 22:09
localStorage privacy setting sample
<!DOCTYPE html>
<html>
<head>
<title>localStorage and privacy setting sample</title>
</head>
<body>
<div id="result"></div>
<script>
(function() {
var key = 'localstorage_test_item',
<html>
<body onload="onload()">
<img src="http://please-sleep.cou929.nu/images/twitter-48.png?normal"/>
<iframe src="./test.html?noraml"></iframe>
<script src="./test.js?noraml"></script>
<script>
// img
(new Image()).src = 'http://please-sleep.cou929.nu/images/twitter-48.png?dynamic';
@cou929
cou929 / hash_sample.html
Created July 31, 2013 06:24
以下の html に "hash_sample.html#foobar" というように hash 付きでアクセスする。IE 系は location.hash が取れないがそれ以外のブラウザだととれる。また document.write した script から見えている window.location はもとの 'hash_sample.html' である。
<html>
<body>
<script>
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
var iframe_doc = iframe.contentWindow.document;
iframe_doc.write('<html><body><sc' + 'ript>alert(window.location.hash)</sc' + 'ript></body></html>');
</script>
</body>
</html>
use strict;
use warnings;
my @lines = <>;
print convert( join '', @lines );
sub convert {
my $text = shift;
$text =~ s/\r//g;
@cou929
cou929 / colorspace.js
Last active December 12, 2015 08:39
HSV色空間
(function(define) {
define([], function() {
'use strict';
var ColorSpace = function() {};
ColorSpace.prototype.HSVtoRGB = function(h, s, v) {
var r, g, b;
while (h < 0) {
@cou929
cou929 / check_file_update.pl
Created December 27, 2012 08:34
ファイルの更新を監視する nagios plugin
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use File::Find::Rule;
use File::Basename;
my $STATE_OK = 0;
my $STATE_WARNING = 1;