Skip to content

Instantly share code, notes, and snippets.

View Phury's full-sized avatar

Pierre-Henri Phury

View GitHub Profile
@Phury
Phury / maps.spec.ts
Created May 24, 2023 11:39
This code show how to play with objects and maps to revert the values and filter them
import {expect} from "@jest/globals";
import {map, of} from "rxjs";
function matchesAny(tuples: [string, string][], prefix: string) {
return tuples.filter(t => matches(t, prefix));
}
function matches(tuple: [string, string], prefix: string) {
return tuple[0].startsWith(prefix)
}
@Phury
Phury / CleanArchitecture.java
Created March 14, 2023 11:18
super power ninja turbo architecture
// couche de présentation
public class TaskController {
private TaskService taskService;
public void addTask(String title, String description) {
Task task = new Task(title, description);
taskService.addTask(task);
}
public List<Task> getTasks() {
@Phury
Phury / component.html
Created February 24, 2023 16:13
AngularX download file directive
<button mat-flat-button class="download-btn" onDownloadFile
[downloadFunc]="downloadCsr.bind(this)"
[contentType]="'application/pkcs10'"
[fileName]="cert.commonName + '.pem'">
{{'certificate.detail.downloadCSR' | translate}}
</button>
@Phury
Phury / BusinessObservabilityConfiguration.java
Last active February 17, 2023 11:16
Configure observability at smals
// configure with spring
@Configuration
public class MetricsContractConfiguration {
@Bean
public MetricContractManager sepiaMetricContractManager(MetricContractManager metricContractManager) {
metricContractManager.addContract("dss_signature_sign", "docType", "signType", "responseCode", "errorType", "callOrigin", "enterpriseNumber", "signProfile");
metricContractManager.addContract("dss_signature_timestamp");
return metricContractManager;
@Phury
Phury / Example.java
Last active January 30, 2023 08:21
Configure prometheus in spring-boot
// metriques de base
@Timed(value = "sign_document_request_duration", description = "The duration of sign document request processing")
public String signDocument(String id, String messageDigest, String signAlgorithm) {
// Your processing code here
}
// afficher les signatures par type d'erreur
@Counted(value = "sign_document_response_status", description = "The number of sign document response by HTTP status code")
public String signDocument(String id, String messageDigest, String signAlgorithm) {
@Phury
Phury / metaGameChart.js
Created April 22, 2022 14:45
Parses the meta info column from Mtgtop8 to display a nice pie chart of the metagame
// example page https://www.mtgtop8.com/archetype?a=816&meta=51&f=MO
function parseData() {
var data = [];
[].forEach.call(document.querySelectorAll(".page table td:first-child .hover_tr"), function(el) {
var tokens = el.textContent.split(/\r?\n/).filter(l => l.trim()).map(l => l.trim());
if (tokens.length == 2) {
data.push({y: parseFloat(tokens[1].replace(" %", "")), label: tokens[0] });
}
});
@Phury
Phury / foreach_folder_in.bat
Created April 20, 2022 09:05
Loop through lines in a input.conf file and execute commands from there
@echo off
REM input.conf structure :
REM sub_folder_1,1.1.0,1.2.0
REM sub_folder_2,1.2.0,1.3.0
REM here we checkout a project a create a new branch
for /F "tokens=*" %%r in (input.conf) do (
for /F "tokens=1,2,3,4 delims=," %%A in ("%%r") do (
cd %%A
@Phury
Phury / mtg_card_acquisition_planning.tsv
Last active May 25, 2023 10:36
My acquisition plan for building legacy MTG decks
format deck cards
oldschool ernhamgeddon sylvan library
oldschool burngeddon (https://www.bazaarofmagic.eu/en-WW/decks/erhnam-burnyem-old-school-93-94/50305)
modern copycat 4x Invasion of Alara, 4x Invasion of Ergamon
modern u/w control 4x Temporary Lockdown
modern as foretold 4x as foretold, 4x restore balance, 2x ancestral vision
legacy u/w polymorph 4x Staff of the storyteller
legacy u/w polymorph 4x Polymorph
legacy cephalid bfast 3x Narcomoeba
pioneer u/b control 3x Sheoldred's Edict
@Phury
Phury / mono_blue_delver.mtgo
Created April 22, 2021 13:43
Legacy Mono Blue Delver
#title: Mono Blue Delver
#builder: Beest
#MTGO - Magic Online 1st (5-0) in MTGO Legacy League — 23-Jan-2021
2 Brazen Borrower
4 Delver of Secrets
4 Ethereal Forager
4 Nivmagus Elemental
1 Force of Negation
3 Stifle
3 Gut Shot
@Phury
Phury / fnm_results.tsv
Last active July 30, 2021 21:11
Results of my FNM games
date format deck link overall result match 1 deck 1 match 2 deck 2 match 3 deck 3
27/03/2020 legacy jund phoenix https://www.mtggoldfish.com/deck/3786991#paper 1-2 2-1 monored prison 1-2 u/w stoneblad 2-0 bomberman
23/07/2020 legacy jund phoenix https://www.mtggoldfish.com/deck/4171748#paper 2-1 0-2 monoblack reanimator 2-0 TES 2-1 burn
30/07/2020 modern twiddle storm https://www.mtggoldfish.com/deck/4190194#paper 1-2 2-1 ally 0-2 Tron 2-0 elves