Skip to content

Instantly share code, notes, and snippets.

View neogeogre's full-sized avatar
:electron:
Still alive

Geoffrey Vincent neogeogre

:electron:
Still alive
View GitHub Profile
@neogeogre
neogeogre / matrix_interp.py
Created May 26, 2020 08:51
two dimentional interpolation in matrix values
from scipy.interpolate import interp2d
def matrix_interp():
mat = numpy.array([[70.45, 0, 21.78, 0],
[0, 0, 0, 0],
[105.12, 0, 1000.45, 0],
[0, 0, 0, 0]])
ix = numpy.where(mat != 0)
@neogeogre
neogeogre / coroutine.kt
Created November 2, 2021 20:10
wait the end of multiple coroutine
import kotlinx.coroutines.Dispatchers.Default
import kotlinx.coroutines.joinAll
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import mu.KotlinLogging
import java.lang.Thread.sleep
private val logger = KotlinLogging.logger {}
fun main() {
@neogeogre
neogeogre / docker-compose-confluence.yml
Last active November 24, 2021 07:52
Confluence and redmine local instance
version: '3'
services:
confluence:
image: idalko/atlassian-confluence
environment:
- DISABLE_NOTIFICATIONS=TRUE
- CONF_ARGS=-Datlassian.plugins.enable.wait=300
volumes:
Install globally a lib with cmake to make it avaiable for C++ project
Easiest way to add a lib to c++ project.
Download source code under `Downloads`:
```sh
cd /home/geoffrey/Downloads/mylib
cmake -DBUILD_SHARED_LIBS=ON .
make install
```
@neogeogre
neogeogre / createFeatureCollection.kt
Last active November 24, 2021 17:11
Sample to create read a geotools FeatureCollection with properties in java / kotlin
package demo
import org.geotools.feature.DefaultFeatureCollection
import org.geotools.feature.simple.SimpleFeatureBuilder
import org.geotools.feature.simple.SimpleFeatureTypeBuilder
import org.geotools.referencing.crs.DefaultGeographicCRS.WGS84
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.GeometryFactory
import org.locationtech.jts.geom.Point
@neogeogre
neogeogre / basicKtor.kt
Last active November 24, 2021 22:55
ktor http rest client usage sample in kotlin
import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.features.*
import io.ktor.client.features.auth.*
import io.ktor.client.features.auth.providers.*
import io.ktor.client.features.json.*
import io.ktor.client.features.logging.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.http.ContentType.Application.Json
@neogeogre
neogeogre / windows-image-viewer.reg
Last active December 7, 2021 10:28
restore windows image viewer
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
"MuiVerb"="@photoviewer.dll,-3043"
[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
@neogeogre
neogeogre / .bashrc
Created January 8, 2022 20:57
pyenv paths
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
@neogeogre
neogeogre / encryption.kt
Created July 21, 2022 10:30
simplest way to have cipher encryption in Kotlin
import java.util.*
import javax.crypto.Cipher.*
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
fun main() {
val str = "Hello World !"
val encryptionKey = "1mfNnQ8CSdxHOhwO"
println(str)
val encoded = encrypt(str, encryptionKey)
@neogeogre
neogeogre / bulk-edit-git-repos.kt
Created August 18, 2022 08:26
Edit plenty of git repos at once
import java.io.File
import java.lang.ProcessBuilder.Redirect.INHERIT
import java.nio.file.Files
import java.util.concurrent.TimeUnit.MINUTES
import kotlin.io.path.Path
const val ROOT = "/home/geoffrey/Desktop/gitlab"
fun main() = Files
.walk(Path(ROOT), 1)