Skip to content

Instantly share code, notes, and snippets.

View ulrich's full-sized avatar
🏠
Working from home

Ulrich VACHON ulrich

🏠
Working from home
View GitHub Profile

Add Starship custom module to display Git user and signkey

If you want to print the git user/singkey for a local repository in the prompt:

Edit the ~/.config/starship.toml file.

[custom.gituser]
style = "bold fg:220"
detect_folders = ['.git']
@ulrich
ulrich / QuickSort.java
Created December 2, 2022 15:54 — forked from djitz/QuickSort.java
Quick Sort Algorithm in Java
package com.djitz.sort;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Quick sort algorithm (simple)
* based on pseudo code on Wikipedia "Quick Sort" aricle
*
@ulrich
ulrich / gist:aa04a793d54703998ecb015a0e2ff803
Created June 23, 2022 14:27
Simple health check for Keycloak
For more explanation you can take a look on this article : https://dev.to/ulrich/simple-health-check-for-keycloak-259p
#!/bin/bash
login_access=$(curl -k -X POST \
-H "Content-Type:application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "client_id=admin-cli" \
-d "username=alive" \
-d "password=[REDACTED]" \
@ulrich
ulrich / PatternMatching.java
Last active April 6, 2021 12:50
Pattern matching in Java 8+
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;
import static java.util.Optional.empty;
import static java.util.Optional.of;
public class PatternMatchingExample {
public static void main(String[] args) {
@ulrich
ulrich / gist:d44b3f0c0b35a2d6a7e87022904e13b4
Created February 16, 2021 13:49
OWASP cheat sheet in Docker
FROM nginx:latest
WORKDIR /tmp
RUN apt-get update && apt-get install -y curl unzip && apt-get clean
RUN curl -fsSL -O https://cheatsheetseries.owasp.org/bundle.zip
RUN unzip bundle.zip && mv site/* /usr/share/nginx/html
@ulrich
ulrich / FizzBuzz.java
Created November 13, 2020 16:03
Fizzbuz Java style 1
package tech.ingenico.ah;
import java.util.function.Function;
import java.util.stream.IntStream;
public class FizzBuzz {
public static final Function<Integer, Integer> MODULO_3 = v -> v % 3;
public static final Function<Integer, Integer> MODULO_5 = v -> v % 5;
public static void run(IntStream intStream) {
@ulrich
ulrich / gist:7c7d5c949047c3f7d90b91c2dcba53f3
Last active November 14, 2020 22:12
Setup Minecraft 1.16.2 with Systemd
#!/bin/bash
sudo apt update -y \
&& sudo apt upgrade -y
sudo apt install \
wget \
screen \
default-jdk \
nmap
@ulrich
ulrich / check_port.go
Created March 21, 2020 16:45
Return a free port available in a range of provided ports.
package main
import (
"errors"
"fmt"
"net"
"strconv"
)
const (

Keybase proof

I hereby claim:

  • I am ulrich on github.
  • I am ulrich (https://keybase.io/ulrich) on keybase.
  • I have a public key whose fingerprint is 6727 271C 5710 1BC9 83F6 CEFC FA02 71C9 77DF 729A

To claim this, I am signing this object:

@ulrich
ulrich / gist:5520431
Created May 5, 2013 10:30
Select specified email from string in Microsoft Webmail interface.
$('td:contains("mappyfactory@map...")').each(function(e) { $($(this).prev('td').find('input')[0]).attr('checked','checked') } )