Skip to content

Instantly share code, notes, and snippets.

@SalomonBrys
SalomonBrys / jdk-update-alternatives.sh
Created August 13, 2014 09:11
jdk-update-alternatives
#!/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"
@SalomonBrys
SalomonBrys / MultiSelectTableView.java
Last active December 11, 2019 11:46
JavaFX TableView that allows multi-selection by default (without holding the control key)
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)

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;
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
@SalomonBrys
SalomonBrys / Stadia-ubuntu.md
Last active February 15, 2023 17:48
Stadia in Ubuntu

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:
#!/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 .
@SalomonBrys
SalomonBrys / KodeinDI-environmentScope.kt
Created December 16, 2020 18:18
Example that shows how to create a scope registry according to a server environment.
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")
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.google.gson.JsonPrimitive
import java.net.HttpURLConnection
import java.net.URL
import kotlin.io.path.Path
import kotlin.io.path.writer
val prefix = "https://github.githubassets.com/images/icons/emoji/unicode/"
val suffix = ".png?v8"