Skip to content

Instantly share code, notes, and snippets.

View yui0's full-sized avatar

Yuichiro Nakada yui0

View GitHub Profile
@yui0
yui0 / KitchenSink.html
Created August 15, 2017 08:15
OnsenUI demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>OnsenUI Tutorial</title>
<!-- Required libs -->
<script src=""></script>
<script src="https://unpkg.com/onsenui/js/onsenui.js"></script>
#!/bin/sh
auto_ssh() {
host=$1
id=$2
pass=$3
expect -c "
set timeout 10
spawn ssh ${id}@${host}
@yui0
yui0 / predict.py
Created September 4, 2017 05:48
image recognition for chainer
# -*- coding: utf-8 -*-
import argparse
import numpy as np
import os
from PIL import Image
import chainer
from chainer import cuda
from chainer import functions as F
@yui0
yui0 / opengles2.c
Created October 6, 2017 14:26
OpenGLES2 on Linux console
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <assert.h>
#include <fcntl.h>
#include <gbm.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@yui0
yui0 / gpgpu_glsl.h
Created October 8, 2017 06:26
GPGPU on OpenGL ES2
//---------------------------------------------------------
// Cat's eye
//
// ©2017 Yuichiro Nakada
//---------------------------------------------------------
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <assert.h>
@yui0
yui0 / fsize.c
Created October 23, 2017 02:31
Get the file size
long fsize(char *name)
{
struct stat stbuf;
int fd = open(name, O_RDONLY);
if (fd == -1) return -1;
if (fstat(fd, &stbuf) == -1) return -1;
close(fd);
return stbuf.st_size;
}
@yui0
yui0 / jsmn.h
Created October 23, 2017 03:41
JSON parser for C
#ifndef __JSMN_H_
#define __JSMN_H_
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
@yui0
yui0 / json.h
Created October 23, 2017 03:41
JSON parser for C
// The latest version of this library is available on GitHub;
// https://github.com/sheredom/json.h
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
@yui0
yui0 / Makefile
Created October 26, 2017 05:37
Makefile template
# ©2017 YUICHIRO NAKADA
PROGRAM = hello
CC = clang
CPP = clang++
CFLAGS = -Wall -Os
CPPFLAGS= $(CFLAGS)
LDFLAGS =
CSRC = $(wildcard *.c)
@yui0
yui0 / recalloc.c
Created October 26, 2017 05:46
recalloc function
void *recalloc(void *p, int s, int ss)
{
void *r = calloc(ss, 1);
if (!r) return 0;
memcpy(r, p, s);
free(p);
return r;
}