Skip to content

Instantly share code, notes, and snippets.

View Leko's full-sized avatar
🏠
Working from home

Shingo Inoue Leko

🏠
Working from home
View GitHub Profile
@Leko
Leko / Dockerfile
Created April 29, 2018 03:42
Run Jupyter notebook with Keras for CPU only arch (ex. MacOS)
ARG cuda_version=9.0
ARG cudnn_version=7
FROM debian:stretch
# Install system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
bzip2 \
g++ \
git \
graphviz \
@Leko
Leko / dining-philosophers.js
Created February 28, 2018 17:17
The dining philosophers implementation of Node.js
/**
* The dining philosophers implementation of Node.js
*
* See also:
* http://rust-lang-ja.github.io/the-rust-programming-language-ja/1.6/book/dining-philosophers.html
*
* (c) 2018 Leko
*/
const cluster = require('cluster')
class Avatar {
constructor (uri) {
this.setUri(uri)
Object.freeze(this)
}
setUri (uri) {
this.uri = uri
}
@Leko
Leko / build-ios
Last active September 6, 2017 01:52
Build ReactNative application via CLI
#!/usr/bin/env bash
# Usage:
# build-ios <SCHEME> <EXPORT_PLIST>
#
# SCHEME:
# EXPORT_PLIST:
set -eu
SCHEME=$1
@Leko
Leko / .gitignore
Last active November 13, 2018 10:12
Example of text to speech with VOICELOID(c)
.env
node_modules
@Leko
Leko / DirtyCheckable.js
Last active June 6, 2017 08:14
Essence of data modeling in JavaScript
const fallbackSuffixes = {
Changed (instance, prop) {
return instance.dirties[prop].changed()
},
Change (instance, prop) {
return instance.dirties[prop].changes()
},
@Leko
Leko / JSON.php
Last active January 5, 2017 06:54
Utility for PHP built-in functions
<?php
namespace Foundation;
class JSONException extends \Exception {}
/**
* Requirement: PHP >= 5.5.0
*/
class JSON
@Leko
Leko / memory_limit.php
Last active December 14, 2016 08:21
PHP memory limit dealing when memory limit exceeded
<?php
class SomeClass {
public function __destruct ()
{
echo __FILE__.':'.__LINE__.PHP_EOL; // Not working
}
}
register_shutdown_function(function () {
<?php
function bench($name, $fn, array $args = array(), $step = 10000) {
$times = array();
while($step--) {
$s = microtime(true);
call_user_func_array($fn, $args);
$e = microtime(true);
$times[] = $e - $s;