Skip to content

Instantly share code, notes, and snippets.

View fboldog's full-sized avatar

Ferenc Boldog fboldog

  • Budapest, Hungary
View GitHub Profile
@fboldog
fboldog / howto.md
Last active January 9, 2022 16:03
hass.io - Xiaomi Temperature Sensor 2 w/ ESP32
@fboldog
fboldog / test.cs
Created October 11, 2019 14:03 — forked from sebastian-dev/test.cs
ADL2 Log
using System;
using System.Runtime.InteropServices;
namespace ATIDisplay
{
static class Kernel32
{
@fboldog
fboldog / Program.cs
Created September 22, 2019 13:07
PMLog initial implementation
using System;
using System.Runtime.InteropServices;
namespace ATIDisplay
{
static class Kernel32
{
uint wang_hash(uint seed)
{
seed = (seed ^ 61) ^ (seed >> 16);
seed *= 9;
seed = seed ^ (seed >> 4);
seed *= 0x27d4eb2d;
seed = seed ^ (seed >> 15);
return seed;
}
@fboldog
fboldog / ChromeTabsSaver.kt
Last active September 27, 2017 13:55
Dead simple tabs export for Chrome on Android
package fboldog.chrometabsaver
import android.content.Intent
import android.support.test.InstrumentationRegistry
import android.support.test.InstrumentationRegistry.getInstrumentation
import android.support.test.uiautomator.UiDevice
import org.junit.Test
import android.support.test.runner.AndroidJUnit4
import android.support.test.uiautomator.UiSelector
import android.util.Log
package hu.akarnokd.comparison
import org.openjdk.jmh.annotations.*
import java.util.*
import java.util.concurrent.TimeUnit
fun main(args: Array<String>) {
val s = ShakespearePlaysScrabbleWithKotlin()
s.init()
System.out.println(s.measureThroughput())
// usage:
// buildscript {
// apply from: 'https://git.io/kotlinEAP'
// ...
// }
// and call kotlinEAP(it) in repositories
ext.kotlinEAP = { RepositoryHandler handler ->
handler.maven {
url 'https://dl.bintray.com/kotlin/kotlin-eap'
@fboldog
fboldog / data-binding-kotlin-1.0.diff
Created February 19, 2016 09:46
Required changes in Android Data Binding for Kotlin 1.0
diff --git a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
index 3d23e13..70317f6 100644
--- a/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
+++ b/compiler/src/main/kotlin/android/databinding/tool/ext/list_ext.kt
@@ -31,13 +31,13 @@ public fun List<String>.joinToCamelCaseAsVar(): String = when(size) {
else -> get(0).toCamelCaseAsVar() + drop(1).joinToCamelCase()
}
-public fun Array<String>.joinToCamelCase(): String = when(size()) {
+public fun Array<String>.joinToCamelCase(): String = when(size) {
@fboldog
fboldog / Actor.kt
Last active February 19, 2016 09:46
Minimalist Kotlin Actors, based on Viktor Klang "Minimalist Java & Scala Actors"
/*
Copyright 2016 Ferenc Boldog
Copyright 2012 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@fboldog
fboldog / ViewInjector.java
Created December 1, 2015 12:51
Dead simple view injection
import android.app.Activity;
import android.support.annotation.IdRes;
import android.view.View;
import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;