Skip to content

Instantly share code, notes, and snippets.

View ymyzk's full-sized avatar
:octocat:
Weekend OSS contributor

Yusuke Miyazaki ymyzk

:octocat:
Weekend OSS contributor
View GitHub Profile
@ymyzk
ymyzk / README.md
Last active July 20, 2019 14:49
Bubble Sort in WebAssembly

Bubble Sort in WebAssembly

  1. python3 server.py
  2. Open http://localhost:8000 with Chrome, Edge, or Firefox
  3. Open the console in your browser
@ymyzk
ymyzk / main.c
Created January 3, 2019 07:08
Using mach_absolute_time to get precise/monotonic clock
#include <inttypes.h>
#include <mach/mach_time.h>
#include <stdio.h>
int main(void) {
static mach_timebase_info_data_t timebase;
mach_timebase_info(&timebase);
uint64_t time = mach_absolute_time();
printf("mach_absolute_time: %" PRIu64 "\n", time);
printf("resolution: %f\n", (double)timebase.numer / (double)timebase.denom);
@ymyzk
ymyzk / migrate.py
Created April 21, 2018 15:47
python-gyazo-backup migrator
#!/usr/bin/env python3
import json
import sys
def main(new_filename, old_filename):
with open(old_filename) as f:
old_images = json.load(f)
with open(new_filename) as f:
new_images = json.load(f)
@ymyzk
ymyzk / main.ml
Last active April 18, 2017 05:14
CPS Interpreter for STLC + shift/reset in OCaml
type id = string
module Environment = Map.Make (
struct
type t = id
let compare (x : id) y = compare x y
end
)
type value =

Keybase proof

I hereby claim:

  • I am ymyzk on github.
  • I am ymyzk (https://keybase.io/ymyzk) on keybase.
  • I have a public key ASAEbZrZgw7WBw8MounDKtLmPAZxt3DKRPio4FuIQoG9OQo

To claim this, I am signing this object:

@ymyzk
ymyzk / index.html
Created June 20, 2016 17:15
Simple example of proper tail calls in ECMAScript 2015
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example of Proper Tail Calls</title>
</head>
<body>
<h1>Example of Proper Tail Calls</h1>
<p>
Please open console. If your web browser supports proper tail calls, it shows "It works!".
@ymyzk
ymyzk / sum.c
Last active June 10, 2016 04:56
Example of optimization (clang & gcc)
int sum(int n) {
int acc = 0;
for (int i = 0; i <= n; i++) {
acc += i;
}
return acc;
}
@ymyzk
ymyzk / multiply_matrix.c
Created June 10, 2016 04:50
Performance comparison of C & Python
#include <stdio.h>
#define N 1024
int main(void) {
int a[N][N];
int b[N][N];
int c[N][N];
for (int i = 0; i < N; i++) {
@ymyzk
ymyzk / README.md
Last active July 4, 2016 01:18
Unofficial fork of OchaCaml

Unofficial fork of OchaCaml

This is an unofficial fork of OchaCaml for Homebrew Formula.

This Gist is not maintained. See ymyzk/ochacaml for latest information.

Changes

  • Character encoding: EUC-JP -> UTF-8
  • Generate a diff file using git diff

Links

@ymyzk
ymyzk / intro.md
Last active October 21, 2015 05:34
第2回 プログラミング大相談会 Django 入門

第2回 プログラミング大相談会 Django 入門

Python 環境整備

OS X の標準の Python 環境は Python 3 が入っていないので Homebrew 等でインストールしましょう.

Homebrew の導入

http://brew.sh/index_ja.html を参考に

Python を Homebrew で導入する