Skip to content

Instantly share code, notes, and snippets.

View import-benjamin's full-sized avatar
💻
I make computers go beep boop

Benjamin import-benjamin

💻
I make computers go beep boop
View GitHub Profile
@import-benjamin
import-benjamin / docker-compose.yml
Created September 11, 2021 20:25
Set up traefik reverse proxy in docker-compose services
version: "3.9"
services:
prometheus:
image: prom/prometheus:v2.28.1
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
cadvisor:
@import-benjamin
import-benjamin / build.sbt
Created July 22, 2021 10:05
Marshalling & Unmarshalling json with akka-http and json4s
name := "json-api-serializer"
version := "0.1"
scalaVersion := "2.13.6"
idePackagePrefix := Some("that.is.a.test")
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor-typed" % "2.6.8",
@import-benjamin
import-benjamin / qemu-bridge.conf.sh
Created December 18, 2020 11:45
Setup bridge configuration with KVM/Qemu
# When encoutering this issue :
#
# Error starting domain: internal error: /usr/lib/qemu/qemu-bridge-helper --br=br0 --fd=25: failed to
# communicate with bridge helper: Transport endpoint is not connected stderr=failed to parse default
# acl file/etc/qemu/bridge.conf
#
# proceed as follows :
sudo mkdir /etc/qemu
sudo touch /etc/qemu/bridge.conf
sudo chmod u+r /etc/qemu/bridge.conf
@import-benjamin
import-benjamin / SQL_TIPS.md
Last active June 8, 2020 07:09
Somes tips in sql

VIEW ALL ATTRIBUTES FROM A TABLE

tip to question : Afficher les caractéristiques de tous les employés tip to q : Afficher les caractéristiques des départements

SELECT * FROM <TABLE_NAME>

VIEW ONE ATTRIBUTE FROM A TABLE

@import-benjamin
import-benjamin / cnn_transfer_learning.py
Created January 30, 2020 21:15
This snippet show how to append additionnal layers to existing CNN by using keras and training new results
from keras.applications import VGG16
from keras.preprocessing.image import ImageDataGenerator
import subprocess
from keras.models import Sequential
from keras.optimizers import RMSprop
from keras.layers import Flatten, Dropout, Dense
print(subprocess.run("git clone https://github.com/aryapei/In-shop-Clothes-From-Deepfashion.git", shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8"))
conv_base = VGG16(input_shape=(224, 224, 3), weights="imagenet", include_top=False)
@import-benjamin
import-benjamin / CaseClassWithAbstractParentWithParameters.scala
Created July 31, 2019 08:43
Case Class with abstract parent with parameters
package classes
abstract class Lunch() {
def eat(): String = {
"burp."
}
def sugarValue:Double
}
case class Soda(sugarValue:Double = 10.0) extends Lunch
package classes
object ImplicitClassSuperRichString {
implicit class SuperRichString(in:String) {
def world:String = in+", world"
}
def main(args: Array[String]): Unit = {
println("Hello" world)
println("Goodnight" world)
}
@import-benjamin
import-benjamin / clickRedirect.js
Created November 26, 2017 15:01
redirect to the homepage if nobody use the mouse for 10 seconds
$(document).ready(function() {
let clique = true
let secondes = 10
$('body').on('click', function() {
clique = true;
})
setInterval(function () {
if (clique == true) {
clique = false
} else {
@import-benjamin
import-benjamin / progeny.sce
Created November 25, 2017 14:48
graph theory : find all successors of a node
function LD = descendants (Pred, x)
count = length(Pred)
LD = []
for k=1:count
if (find(chemin_arbre(Pred, k)==x)~=[]) then
LD = [LD, k]
end
end
endfunction
@import-benjamin
import-benjamin / adja2incidence.sce
Created November 25, 2017 14:46
graph theory : convert adjacency matrix to incidence matrix
// desc : retourne une matrice adjacence sous forme de matrice d'incidence.
// input : matrice d'adjacence (M)
// output : matrice d'incidence (res)
function res = adja2incidence(M) // soucis : les boucles ne sont pas notées
[S, T] = mat2listes(M)
res =zeros(length(T), length(S)-1)
for k=1:size(M, 1) // on marque tout les arcs rentrant dans le sommet
res(k, predecesseurs(M,k)) = -1
end
for k=1:size(M, 1) // on marque tout les arcs sortant du sommet