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 retry(isDone, next) { | |
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
var id = window.setInterval( | |
function() { | |
if (isDone()) { | |
window.clearInterval(id); | |
next(is_timeout); | |
} | |
if (current_trial++ > max_retry) { | |
window.clearInterval(id); |
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
/** | |
* load-external-script-snippet.js | |
* Kosei Moriyama <cou929@gmail.com> | |
* | |
* Simple code snippet for loading external script from a bookmarklet. | |
* Replace example url of script to your target script url before use. | |
*/ | |
(function() { | |
var u = 'http://example.com/bookmarklet.js'; |
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
$ perl -MData::Dumper -le 'my $a = +{}; $a->{foo}->{bar}++; $a->{foo}->{bar}++; $a->{foo}->{baz}++; $a->{blah}->{blah}++; print Dumper $a;' | |
$VAR1 = { | |
'blah' => { | |
'blah' => 1 | |
}, | |
'foo' => { | |
'bar' => 2, | |
'baz' => 1 | |
} | |
}; |
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
post: | |
responses: | |
201: | |
description: test | |
content: | |
application/json: | |
schema: | |
$ref: ref2.yaml | |
description: the order of this description directive changes between versions |
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
<html> | |
<body> | |
<script type="text/javascript"> | |
var blackhole_image_url = 'http://blackhole.webpagetest.org/', | |
wait_interval = 3000; | |
// 3秒じゃタイムアウトされない | |
loadWithImageElement(blackhole_image_url + 'element.png'); | |
// 3秒じゃタイムアウトされない |
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
/* https://github.com/cou929/sql-fingerprint-js */ | |
CREATE TEMP FUNCTION fingerprint(sql STRING, matchMD5Checksum BOOL, matchEmbeddedNumbers BOOL) | |
RETURNS STRING | |
LANGUAGE js AS r""" | |
function fingerprint(sql, matchMD5Checksum, matchEmbeddedNumbers) { | |
let query = sql; | |
// special cases | |
if (/^SELECT \/\*!40001 SQL_NO_CACHE \*\/ \* FROM `/.test(query)) { |
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
/** | |
* script-loader.js | |
* Load external scripts one by one. | |
* (Load certain script after previous script is loaded.) | |
*/ | |
(function script_loader(scripts) { | |
if (scripts.length <= 0) return; | |
var uri = scripts.shift(); | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; |
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 tddjs = tddjs || {}; | |
(function(global) { | |
global.ajax = {}; | |
var ajax = global.ajax; | |
/** | |
* Define ajax.create() | |
*/ | |
var i, l; |
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
#! /bin/sh | |
# postfix and dovecot setup script (instead of sendmail) | |
# based on http://centossrv.com/postfix.shtml | |
echo "### install postfix via yum if not exist" | |
if [ ! -e /etc/postfix/main.cf ] | |
then | |
sudo yum -y install postfix | |
else |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import smtplib | |
import sys | |
import os | |
from email.MIMEText import MIMEText | |
from email.Utils import formatdate | |
from email.Header import Header | |
from optparse import OptionParser |
NewerOlder