Skip to content

Instantly share code, notes, and snippets.

💭
🔪

Takayosi Amagi fand

💭
🔪
Block or report user

Report or block fand

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fand
fand / md5.pl
Created Jan 31, 2014
Digest::MD5 hex digest ???
View md5.pl
use strict;
use warnings;
use utf8;
use Encode;
use Digest::MD5;
use v5.010;
my $str = 'ジムに行き筋肉ムキムキ';
# OOP style
@fand
fand / mosh.pl
Created May 16, 2014
Perl AVI datamosh 修正版
View mosh.pl
open $f_in, '<', $ARGV[0];
read $f_in, my $buf, -s $ARGV[0];
my ( $movi, $idx1 ) = ( index( $buf, "movi" ), index( $buf, "idx1" ) );
my @frames =
map { [ unpack( 'a4VVV', substr( $buf, $idx1 + 8 + $_ * 16, 16 ) ) ] }
0 .. ( ( unpack( 'V', substr( $buf, $idx1 + 4, 4 ) ) / 16 ) - 1 );
my ( $movi_new, $idx1_new, $count ) = ( "movi", substr( $buf, $idx1, 8 ), 0 );
for (@frames) {
my $offset = length $movi_new;
if (@$_[0] =~ /00d./ && @$_[1] & 0x10 && $count != 0) {
View cpusound.js
var spawn = require('child_process').spawn;
var top = spawn('top', ['-b', '-d', '1']);
var buf = '';
top.stdout.on('data', function(data){
buf = data.toString();
});
var baudio = require('baudio');
var b = baudio(function (t, i) {
@fand
fand / check-odd.coffee
Created Sep 20, 2014
Q.Promiseつかう
View check-odd.coffee
## いろいろなPromiseライブラリを使ってみる
## Qだけthrow new Errorが捕まえられなかった
# {Promise} = require 'es6-promise'
Promise = require('q').Promise
# Promise = require 'bluebird'
checkOdd = (num) ->
return new Promise (resolve) ->
if typeof num isnt 'number'
@fand
fand / initManually.js
Created Jul 11, 2015
WDIO3 multi browser test
View initManually.js
'use strict';
var webdriverio = require('webdriverio');
var assert = require('assert');
describe('top page', function () {
var chrome, firefox;
before(function *() {
chrome = webdriverio.remote({ desiredCapabilities : {browserName : 'chrome'} });
@fand
fand / memo.md
Last active Aug 29, 2015
Esprima Syntax メモ
View memo.md

かならず Program で始まる

Program

  • type
  • body: [Statement]
    • ExpressionStatement, VariableDeclaration, EmptyStatement, DebuggerStatement, TryStatement が入る?
@fand
fand / router.js
Created Jul 17, 2015
Promiseベースの簡易ルータ
View router.js
const EVENT = (pageID) => 'register:' + pageID
class Router extends EventEmitter {
constructor () {
this.routes = {};
}
getController (pageID) {
return new Promise((resolve, reject) => {
this.once(EVENT(pageID), function () {
@fand
fand / eslint.js
Created Oct 1, 2015
勤怠と同時にESLint設定かえるくん
View eslint.js
'use strict';
var fs = require('fs-promise');
var SECRET = require('../SECRET');
module.exports = function (mode) {
// ESLint設定を変更する
var indentValue;
View gist:5752117
@font-face {
font-family: droidsans;
src: url('http://font.gmork.in/droidsans') format('svg');
}
#droidsans{
font-family: droidsans;
}
@fand
fand / synth one liner
Created Jul 19, 2013
one-liner music in perl one-liner
View synth one liner
perl -e 'while(1){print pack("S",(((($t*(($t<<3)+303|$t<<7|$t>>10|($t<<4)+200|($t>>5&80)|($t*$t-606)&(~$t>>4))&808+$t>>12)&(101|151)&$t>>4))|($t|(($t>>8|$t<<5|$t<<7|$t>>14)&7|(~$t>>5))&$t>>6)&(~$t>>10))).pack("S",(((($s*(($s<<3)+303|$s<<7|$s>>10|($s<<4)+200|($s>>5&80)|($s*$s-606)&(~$s>>4))&808+$s>>12)&(101|151)&$s>>4))|($s|(($s>>8|$s<<5|$s<<7|$s>>14)&7|(~$s>>5))&$s>>6)&(~$s>>10))); $t+=1.5; $s+=96}' | pacat
You can’t perform that action at this time.