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 / compile.sh
Last active August 29, 2015 14:10
OS X 10.10.2 Patch
clang -dynamiclib -framework AppKit patch.m -arch i386 -arch x86_64 -o patch.dylib
@ymyzk
ymyzk / gist:023f34bab3c46012a2c1
Created December 17, 2014 17:02
Python while 1 vs. while True
import dis
def while_1():
while 1:
pass
def while_true():
while True:
pass
@ymyzk
ymyzk / existence.zsh
Last active August 29, 2015 14:14
Comparison of 'which', 'command -v', 'type' and 'hash'
query=vim
time bash -c "for i in {0..1000}; do which $query; done >/dev/null 2>&1"
time bash -c "for i in {0..1000}; do command -v $query; done >/dev/null 2>&1"
time bash -c "for i in {0..1000}; do type $query; done >/dev/null 2>&1"
time bash -c "for i in {0..1000}; do hash $query; done 2>/dev/null"
time zsh -c "for i in {0..100000}; do which $query; done >/dev/null 2>&1"
time zsh -c "for i in {0..100000}; do command -v $query; done >/dev/null 2>&1"
time zsh -c "for i in {0..100000}; do type $query; done >/dev/null 2>&1"
time zsh -c "for i in {0..100000}; do hash $query; done 2>/dev/null"
@ymyzk
ymyzk / unixtime.py
Created April 10, 2015 05:26
Python datetime object <-> Unix time
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import calendar
import datetime
import time
import pytz
@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 で導入する

@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 / 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 / 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 / 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