Skip to content

Instantly share code, notes, and snippets.

View makotom's full-sized avatar
👋
Huomiseen. Bye.

Makoto Mizukami makotom

👋
Huomiseen. Bye.
View GitHub Profile
@makotom
makotom / gist:1096454
Created July 21, 2011 03:46
UserJS for Opera to fix blank-pages problem in Google+
(function(){
// if(location.toString().match(/^https?:\/\/[^\/.]+\.google\.com\//)){ // It does affect all Google pages?
if(location.toString().match(/^https?:\/\/plus\.google\.com\//)){
history.replaceStateOriginal = history.replaceState;
history.replaceState = function(state, title, url){
if(url !== location.toString() && url !== location.pathname){
if(!state){
location.href = url;
}else{
history.replaceStateOriginal(state, title, url);
@makotom
makotom / doudemoiine.js
Created August 1, 2011 06:56
どうでもいいね for Facebook
(function(){
if(!location.href.match(/^http:\/\/www\.facebook\.com\/plugins\/like\.php/)) return;
if(document.documentElement.getAttribute("lang") !== "ja") return;
var style = document.createElement("style");
style.appendChild(document.createTextNode(".liketext:before{ content: \"どうでも\" }"));
document.documentElement.appendChild(style);
})();
@makotom
makotom / 2ch.js
Created September 10, 2011 01:07
UserJS to omit redirections in 2ch BBS.
addEventListener("DOMContentLoaded", function(){
if(location.hostname.indexOf(".2ch.net", location.hostname.length - ".2ch.net".length) === -1) return;
var a = document.getElementsByTagName("a"), i;
for(i = 0; i < a.length; i += 1) a[i].href = a[i].href.replace(/:\/\/ime\.nu\//, "://");
}, false);
@makotom
makotom / gist:1738537
Created February 4, 2012 15:39
ももんがコレクター
#!/usr/bin/php
<?php
$c = array();
for($i = 1; $i <= 30; $i += 1){
if($i !== 1) sleep(2);
$tmp = json_decode(file_get_contents("http://search.twitter.com/search.json?q=%E3%82%82%E3%82%82%E3%82%93%E3%81%8C&rpp=100&result_type=recent&page={$i}"));
$c = (isset($tmp->results) && is_array($tmp->results)) ? array_merge($c, $tmp->results) : $c;
echo "{$i}: Collected " . count($c) . " statuses.\n";
}
@makotom
makotom / paper.js
Created May 10, 2012 14:46
JS to format academic papers - aiming to substitute TeX
addEventListener("DOMContentLoaded", function(){
"use strict";
var f, e, p, s, i = 0, n = 0;
f = document.createElement("style");
f.appendChild(document.createTextNode("\n"));
e = document.getElementsByTagName("section");
for(i = 0; i < e.length; i += 1){
p = e[i].parentNode;
@makotom
makotom / main.html
Created June 3, 2012 05:36
JavaScript Stroop Test Extended
<!doctype html>
<meta charset="UTF-8">
<title>JSST-EX</title>
<!--
JavaScript Stroop Test Extended
Copyright © 2012 Makoto Mizukami.
http://makotom.org/
The main idea of this work is derived from JSStroop by Makoto Mizukami, although it was fully rewritten.
http://tomato.myftp.org/blog/?tag=JSStroop
@makotom
makotom / toc.php
Created June 23, 2012 10:16
CD-DA TOC Parser (outputs in .cue form)
<?php
if(empty($argv[1])){
exit();
}
$fh = fopen($argv[1], "r");
fread($fh, 4);
$ret = "";
@makotom
makotom / subc.php
Created June 23, 2012 10:28
Converts CD-DA clone image by readom to CUE sheet music
<?php
if(empty($argv[1]) || empty($argv[2])){
exit();
}
function put_binary($data){
global $fh_b;
fwrite($fh_b, $data);
return;
}
@makotom
makotom / ergo3.html
Created July 31, 2012 14:03
Simple scriptlet to examine Fitts's law
<!doctype html>
<meta charset="UTF-8">
<title>ergo3</title>
<style>
body{
margin-left: 100px;
margin-right: 100px;
}
#sw{
@makotom
makotom / cdda2cue.sh
Last active October 11, 2015 10:28
Rip a precise CD audio copy (as a replacement of EAC)
#!/bin/bash
DEV=/dev/sr0
OFFSET=6
cdparanoia -d $DEV -O $OFFSET 1- data.wav
cdrdao read-toc --device $DEV cdda.toc
toc2cue cdda.toc cdda-tmp.cue
sed -e s/BINARY/WAVE/ cdda-tmp.cue > cdda.cue
rm cdda.toc cdda-tmp.cue