Skip to content

Instantly share code, notes, and snippets.

View kikuchy's full-sized avatar

Hiroshi Kikuchi kikuchy

View GitHub Profile
// Robolectric のApplicationContext
val context = RuntimeEnvironment.application
// Testing Support LibraryのApplicationContext
val context = InstrumentationRegistry.getTargetContext()
@kikuchy
kikuchy / main.c
Created October 4, 2017 07:28
GoからCの関数をコールバック関数として呼び出したい。けどGoからCの関数ポインタを関数として呼び出すことはできない。のでなんとかした。
#include <stdio.h>
#include "worker.h"
void cb(int hoge) {
printf("value: %d\n", hoge);
}
int main() {
DoSomeCallback(cb);
}
from keras.applications.inception_v3 import InceptionV3
from keras.applications.inception_v3 import preprocess_input
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D, ZeroPadding2D, GlobalAveragePooling2D, AveragePooling2D
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import ModelCheckpoint, CSVLogger, LearningRateScheduler, ReduceLROnPlateau
from keras.optimizers import SGD
from keras.regularizers import l2
import matplotlib.image as mpimg
@kikuchy
kikuchy / CoreFoundation.def
Last active April 16, 2017 12:06
Kotlin/Native で CoreFoundation を扱いたいけれどうまくいかなかった
headers =
headers.osx = CoreFoundation/CoreFoundation.h
compilerOpts =
compilerOpts.osx = -framework CoreFoundation -Wall
{
"artwork": {
"id": "vector",
"canvasColor": null,
"width": 24,
"height": 24,
"layers": [
{
"id": "path",
"type": "path",
fun main(args: Array<String>) {
val tmpPath = File(System.getProperty("java.io.tmpdir")).toPath()
val fileAttribute = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwx---"))
val tmpDir = Files.createTempDirectory(
tmpPath,
"hogehoge",
fileAttribute
).toFile()
val git = Git.
init().
@kikuchy
kikuchy / keymap.c
Created July 22, 2016 12:24
無変換、変換部はPC側でリマップして使う(HomeとEndになっているので)
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@kikuchy
kikuchy / MyProcessor.java
Created July 20, 2016 16:27
Generate Kotlin extension code and not working... X(
package com.example;
import com.google.auto.service.AutoService;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Set;
class IntentDelegateExt {
operator fun getValue(thisRef: Activity, property: KProperty<*>): String? =
thisRef.intent.getStringExtra(property.name)
}
@kikuchy
kikuchy / ContextCompatKotlin.kt
Last active September 29, 2017 15:00
Extension functions for ContextCompat methods
package net.kikuchy.compatkotlinextention
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v4.content.ContextCompat
/*
Copyright 2016 kikuchy