Skip to content

Instantly share code, notes, and snippets.

View fand's full-sized avatar
💭
🔪

AMAGI / Jun Yuri fand

💭
🔪
View GitHub Profile
@font-face {
font-family: droidsans;
src: url('http://font.gmork.in/droidsans') format('svg');
}
#droidsans{
font-family: droidsans;
}
@fand
fand / synth one liner
Created July 19, 2013 20:14
one-liner music in perl 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 December 28, 2015 12:38
C言語テストごっこ
#include <stdio.h>
#include "tester.h"
int test1();
int test2();
int test3();
int main ()
{
test_start();
@fand
fand / test.coffee
Created November 29, 2013 10:42
((coffeescriptで) 書く (Lisp) インタプリタ) テスト
#!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 December 29, 2015 17:29
((coffeescriptで) 書く (Lisp) インタプリタ)
#!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 December 30, 2015 02:59
include .cpp to .hpp in C++ template class
#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 January 8, 2014 15:53
Delay effect in Web Audio API, but it kills Chrome...
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 January 8, 2014 22:07
Panner node alternative for Web Audio API
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 January 31, 2014 08:26
Digest::MD5 hex digest ???
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 01:20
Perl AVI datamosh 修正版
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) {