Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🔪

Takayosi Amagi fand

💭
🔪
View GitHub Profile
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
@fand
fand / main.c
Last active Dec 28, 2015
C言語テストごっこ
View main.c
#include <stdio.h>
#include "tester.h"
int test1();
int test2();
int test3();
int main ()
{
test_start();
@fand
fand / test.coffee
Created Nov 29, 2013
((coffeescriptで) 書く (Lisp) インタプリタ) テスト
View test.coffee
#!usr/bin/env coffee
# coding: utf-8
scheme = require './scheme.coffee'
##########################
# Tests
##########################
repl = scheme.repl
assert = (a,b) -> if a == b then console.log("ok") else console.log("ng\t a: " + a + "\t b: " + b)
@fand
fand / scheme.coffee
Last active Dec 29, 2015
((coffeescriptで) 書く (Lisp) インタプリタ)
View scheme.coffee
#!usr/bin/env coffee
# coding: utf-8
##########################
# Utilities
##########################
type = do ->
classToType = {}
for name in 'Boolean Number String Function Array Date RegExp Undefined Null'.split(' ')
@fand
fand / tempclass.cpp
Last active Dec 30, 2015
include .cpp to .hpp in C++ template class
View tempclass.cpp
#include <iostream>
template<class T>
TempClass<T>::TempClass(){
std::cout << "new" << std::endl;
}
template<class T>
TempClass<T>::~TempClass(){
std::cout << "delete" << std::endl;
@fand
fand / gist:8318958
Created Jan 8, 2014
Delay effect in Web Audio API, but it kills Chrome...
View gist:8318958
class @FX
constructor: (@ctx) ->
@in = @ctx.createGain()
@in.gain.value = 1.0
@out = @ctx.createGain()
@out.gain.value = 1.0
@view = new FXView(this)
connect: (dst) -> @out.connect(dst)
disconnect: () -> @out.disconnect()
@fand
fand / gist:8325352
Created Jan 8, 2014
Panner node alternative for Web Audio API
View gist:8325352
class @Panner
constructor: (@ctx) ->
@in = @ctx.createChannelSplitter(2)
@out = @ctx.createChannelMerger(2)
@l = @ctx.createGain()
@r = @ctx.createGain()
@in.connect(@l, 0)
@in.connect(@r, 1)
@l.connect(@out, 0, 0)
@r.connect(@out, 0, 1)
@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) {
You can’t perform that action at this time.