Skip to content

Instantly share code, notes, and snippets.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:icalendar-ruby
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Asia/Tokyo
BEGIN:STANDARD
DTSTART:19700101T000000
TZOFFSETFROM:+0900
TZOFFSETTO:+0900
@fchiba
fchiba / Makefile
Created October 5, 2017 08:21
Expected: "done" without errors, actual: "RangeError: Maximum call stack size exceeded." on Safari WebAssembly.
default: test.html test-wasm.html
test-asm.html: test.o lib1.js
emcc -g -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['lib1.js']" -o $@ test.o
test-wasm.html: test.o lib1.wasm
emcc -g -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['lib1.wasm']" -s BINARYEN=1 -o $@ test.o
.c.o:
emcc -g -O0 -c -o $@ $<
@fchiba
fchiba / Makefile
Last active May 1, 2017 12:20
Reproduction code of wrong postSets chunking (expected: "1"(true), actual "0"(false))
all: main.html sub.js
main.html: main.c
emcc -s MAIN_MODULE=1 -o $@ $< --pre-js pre.js
sub.js: sub.c
emcc -s SIDE_MODULE=1 -o $@ $< -s "EXPORTED_FUNCTIONS=['_global_var']";
run:
emrun main.html
@fchiba
fchiba / test.html
Created April 28, 2017 05:47
Emscripten sample: output
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Emscripten-Generated Code</title>
<style>
body {
font-family: arial;
margin: 0;
@fchiba
fchiba / test.c
Last active April 28, 2017 05:46
Emscripten sample
#include <stdio.h>
int main(int argc, char* argv[])
{
puts("Hello world!");
}
@fchiba
fchiba / separate.sh
Created February 21, 2017 05:44
Make google photo date separator
#!/bin/bash
convert -gravity center -size 1024x64 -background white -fill blue -pointsize 64 label:2017/2/17 20170217.jpeg
exiftool "-CreateDate=2017/02/17 00:00:00" 20170217.jpeg
convert -gravity center -size 1024x64 -background white -fill blue -pointsize 64 label:2017/2/18 20170218.jpeg
exiftool "-CreateDate=2017/02/18 00:00:00" 20170218.jpeg
convert -gravity center -size 1024x64 -background white -fill blue -pointsize 64 label:2017/2/19 20170219.jpeg
exiftool "-CreateDate=2017/02/19 00:00:00" 20170219.jpeg
@fchiba
fchiba / headermap.rb
Created October 7, 2016 06:05
clang HeaderMap parser
file = File.binread(ARGV[0])
(magic, version, reserved, offset, num_entries, num_buckets, maxlen) = header = file.unpack("Vv2V4")
#p header
buckets_bytes = file[24,num_buckets*3*4].unpack("V*")
strings = file[24+num_buckets*3*4..-1]
#p buckets_bytes
#p strings
def hashkey(str)
@fchiba
fchiba / dame.rb
Created August 28, 2015 08:26
CORSの制約を無視するProxy(開発用) しかし、httpsには使えないのであった…
#!/usr/bin/env ruby
require 'uri'
require 'webrick'
require 'webrick/httpproxy'
KEY = "Access-Control-Allow-Origin"
handler = Proc.new() {|req,res|
unless res.header.has_key? KEY
res.header[KEY] = "*"
@fchiba
fchiba / mem_check.js
Created August 26, 2015 06:50
Memory access checker for emscripten (Change ADDR what you want to check, pass "--pre-js mem_check.js" to emcc and apply wrapper.patch)
function WrapArray(arr) {
var ADDR = 25915336;
return new Proxy(arr, {
get: function(target, name) {
if(name == ((ADDR / arr.BYTES_PER_ELEMENT)|0)) {
console.log("Read access detected", new Error().stack);
}
if(typeof target[name] === "function") {
return function() {
@fchiba
fchiba / lircd.conf
Created August 11, 2013 08:57
my lircd.conf
begin remote
name light
bits 40
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 3492 1727
one 445 1296