Skip to content

Instantly share code, notes, and snippets.

View fb64's full-sized avatar

Florian Bernard fb64

  • France
View GitHub Profile
@fb64
fb64 / kotlin_dataframe_clickhouse_example.ipynb
Last active October 10, 2024 21:13
Kotlin Dataframe with ClickHouse + Arrow example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"description": "DuckDB integration with Kotlin Dataframe",
"properties": [
{
"name": "duckdb-version",
"value": "0.10.2"
},
{
"name": "duckdb-database",
"value": ""
@fb64
fb64 / Main.java
Last active February 2, 2024 18:50
arrow-dataset parquet JNI error
import org.apache.arrow.dataset.file.FileFormat;
import org.apache.arrow.dataset.file.FileSystemDatasetFactory;
import org.apache.arrow.dataset.jni.DirectReservationListener;
import org.apache.arrow.dataset.jni.NativeMemoryPool;
import org.apache.arrow.dataset.scanner.ScanOptions;
import org.apache.arrow.dataset.scanner.Scanner;
import org.apache.arrow.dataset.source.Dataset;
import org.apache.arrow.dataset.source.DatasetFactory;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
#!/bin/sh
for i in `openssl list-cipher-commands`
do
RES="decrypt/${i}.gif"
openssl $i -d -in $1 -out $RES -pass pass:$2
if [ $? -eq 0 ]; then
echo "OK"
else
rm -rf $RES
fi
@fb64
fb64 / BitmapExtension.kt
Last active January 7, 2019 10:00
Bitmap extension to compresse Bitmap to ByteArray with a maximum size
import android.graphics.Bitmap
import java.io.ByteArrayOutputStream
fun Bitmap.compressToByteArray(maxSize: Long, stepQuality: Int = 5): ByteArray? {
try {
val byteArrayOutputStream = ByteArrayOutputStream()
var compressionQuality = 100
var byteArray: ByteArray?
do {
if (compressionQuality <= 0) return null
@fb64
fb64 / build.gradle
Created November 11, 2018 20:31
gragle build configuration for creating new elastic plugin
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.elasticsearch.gradle:build-tools:6.4.3"
}
}
@fb64
fb64 / CacheConfiguration.kt
Last active March 27, 2018 10:22
Workaround to load infinispan config from classthpath with spring-boot jcache configuration.
import org.infinispan.configuration.parsing.ParserRegistry
import org.infinispan.jcache.embedded.JCacheManager
import org.infinispan.manager.DefaultCacheManager
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.cache.CacheProperties
import org.springframework.cache.annotation.EnableCaching
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import java.net.URI
import javax.cache.CacheManager
@fb64
fb64 / haproxy.conf
Created July 26, 2017 15:31 — forked from thpham/haproxy.conf
test config haproxy for gRPC loadbalancing
global
tune.ssl.default-dh-param 1024
defaults
timeout connect 10000ms
timeout client 60000ms
timeout server 60000ms
frontend fe_http
mode http
#!/bin/bash
#run certbot to renew certificate
certbot renew --pre-hook "service haproxy stop" --post-hook "service haproxy start"
#update certificate file for haproxy
DOMAIN='your-domain.com' sudo -E bash -c 'cat /etc/letsencrypt/live/$DOMAIN/fullchain.pem /etc/letsencrypt/live/$DOMAIN/privkey.pem > /etc/haproxy/certs/$DOMAIN.pem'