Skip to content

Instantly share code, notes, and snippets.

@SalomonBrys
SalomonBrys / KodeinDI-environmentScope.kt
Created Dec 16, 2020
Example that shows how to create a scope registry according to a server environment.
View KodeinDI-environmentScope.kt
import org.kodein.di.*
import org.kodein.di.bindings.Scope
import org.kodein.di.bindings.ScopeRegistry
import org.kodein.di.bindings.StandardScopeRegistry
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicReference
enum class Environment(val baseUrl: String) {
DEBUG("http://localhost"),
PROD("https://api.awesome-service.com")
View build-native.sh
#!/bin/bash
set -e
[[ -z "$TARGET" ]] && echo "Please set the PLATFORM variable" && exit 1
mkdir -p build/$TARGET
cd build/$TARGET
cmake ../../native-lib
cmake --build .
View Stadia-ubuntu.md

Stadia in Ubuntu

1. Install Chromium-vaapi & drivers

  • Add the chromium-vaapi dev repository:
    sudo add-apt-repository ppa:saiarcot895/chromium-beta
    sudo apt-get update
    
  • Install Chromium-vaapi:
View LockComparisons.kt
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.sync.withPermit
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
import kotlin.system.measureTimeMillis
View Kodein-hiring.md

WE ARE HIRING KOTLIN FAN!

Founded in 2018, with headquarters in Paris, France, Kodein ambition is to create the first Kotlin expertise center in Europe. We address needs of developers, QA, support, sales, marketing and design teams to help them build, test and deploy their Kotlin projects with the best customer experience.

This goal is centered around 3 axes :

  • Consulting and expertise in architecture and development;
@SalomonBrys
SalomonBrys / MultiSelectTableView.java
Last active Dec 11, 2019
JavaFX TableView that allows multi-selection by default (without holding the control key)
View MultiSelectTableView.java
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableView;
import java.util.HashSet;
import java.util.function.Consumer;
/**
* TableView that allows multi-selection by default (without holding the control key)
View jdk-update-alternatives.sh
#!/bin/sh
JHOME=$(pwd)
for jbin in jar java javac javadoc javah javap javaws jvisualvm keytool; do
if [ ! -x $JHOME/bin/$jbin ]; then
echo "ERROR: Cannot find: $JHOME/bin/$jbin"
else
update-alternatives --install "/usr/bin/$jbin" "$jbin" "$JHOME/bin/$jbin" 1
update-alternatives --set "$jbin" "$JHOME/bin/$jbin"