View client.rb
require "socket"
s = TCPSocket.open("localhost", 9000)
s.puts "hello!"
s.close
View thread.cpp
#include <windows.h>
#include <stdio.h>
template<typename Runnable>
class Thread {
private:
Runnable runnable;
HANDLE handle;
DWORD id;
public:
View memo.md

mingwでもタスクトレイ常駐する系のアプリをWin32APIだけでつくりたい

  • タスクトレイを触るにウィンドウハンドラが必要なので、表示しなくても適当なウィンドウは作っておく必要がある
  • アイコンの扱いが面倒
  • とりあえずbrewでmingwだけ入れればビルドできる
  • mingwのg++で -mwindows -static -DUNICODE オプションが必要(つけないとlibstdc++あたりのdllがないって怒られるし文字化けする)
  • windresではオプションに -c 65001 を指定する必要あり(UTF-8)
  • wine 3.0系の問題なのか、Macでは32bitにしないとwineが起動しない
View ExampleUnitTest.kt
// app/src/test/(java|kotlin))/(package名)/ExampleUnitTest.kt
@RunWith(AndroidJUnit4::class)
class ExampleUnitTest {
@Test
fun useAppContext() {
val context = InstrumentationRegistry.getTargetContext()
val sp = context.getSharedPreferences("hoge", Context.MODE_PRIVATE)
sp.edit().putBoolean("hoge", true).apply()
assertTrue(sp.getBoolean("hoge", false))
View build.gradle
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.0-alpha-2"
testImplementation 'androidx.test:runner:1.1.0-alpha2'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha2'
View getapplicationcontext.kt
// Robolectric のApplicationContext
val context = RuntimeEnvironment.application
// Testing Support LibraryのApplicationContext
val context = InstrumentationRegistry.getTargetContext()
View main.c
#include <stdio.h>
#include "worker.h"
void cb(int hoge) {
printf("value: %d\n", hoge);
}
int main() {
DoSomeCallback(cb);
}
View fine_tuning_inceptionv3.py
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
View CoreFoundation.def
headers =
headers.osx = CoreFoundation/CoreFoundation.h
compilerOpts =
compilerOpts.osx = -framework CoreFoundation -Wall
View before.iconanim
{
"artwork": {
"id": "vector",
"canvasColor": null,
"width": 24,
"height": 24,
"layers": [
{
"id": "path",
"type": "path",