Skip to content

Instantly share code, notes, and snippets.

View Romain-P's full-sized avatar
🈴
/home

- Romain-P

🈴
/home
View GitHub Profile
@Romain-P
Romain-P / ChaCha20-Poly1305.kt
Last active January 6, 2024 14:39
ChaCha20-Poly1305 Java/Kotlin Implementation
import java.io.File
import java.io.RandomAccessFile
import java.nio.ByteBuffer
import java.security.KeyFactory
import java.security.KeyPairGenerator
import java.security.SecureRandom
import java.security.spec.PKCS8EncodedKeySpec
import java.security.spec.X509EncodedKeySpec
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
@Romain-P
Romain-P / Main.kt
Created August 29, 2023 13:30
Create zip in memory.
import java.io.*
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
fun main() {
val sourcePath = "toZip"
val outputStream = ByteArrayOutputStream()
try {
@Romain-P
Romain-P / ArenaReplay.cpp
Last active May 6, 2024 22:18
Arena Replay Module for AzerothCore - Wow wotlk 3.3.5a
//
// Created by romain-p on 17/10/2021.
//
#include "Player.h"
#include "Opcodes.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "ScriptMgr.h"
#include <unordered_map>
<loadData
file="t_famille.csv" relativeToChangelogFile="true"
quotChar="&quot;"
seperator=","
tableName = "T_FAMILLE" >
<column header="FAM_IDENT" type="numeric"/>
<column header="FAM_INTLOTEXP" type="string"/>
<column header="FAM_INTLOTIMP" type="string"/>
<column header="FAM_REFEXTERNE" type="string"/>
<column header="FAM_CODE" type="string"/>
<profile>
<id>skipInstall</id>
<activation>
<property>
<name>maven.install.skip</name>
<value>true</value>
</property>
</activation>
<build>
<pluginManagement>
package fr.idfm.sb.payment.client.vault.http;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import fr.idfm.sb.payment.client.VaultConfig;
import fr.idfm.sb.payment.client.dto.vault.AuthDto;
import fr.idfm.sb.payment.client.dto.vault.VaultLoginRequestDto;
import fr.idfm.sb.payment.client.dto.vault.VaultLoginResponseDto;
import fr.idfm.sb.payment.client.dto.vault.VaultTokenLookupSelfResponseDto;
import fr.idfm.sb.payment.common.constant.CustomHttpHeaders;
@Romain-P
Romain-P / Main.kt
Last active February 3, 2022 17:57
Maven POM - Dependency versions hard values to properties using a script
import java.io.File
import java.util.regex.Pattern
object Main {
val propertyPattern = Pattern.compile("<dependency>\\r\\n\\s+<groupId>.+<\\/groupId>\\r\\n\\s+<artifactId>(.+)<\\/artifactId>\\r\\n\\s+<version>([0-9].+)<\\/version>", Pattern.MULTILINE).toRegex()
val duplicatePattern = Regex("<([^>]+)>([0-9.A-Za-z]+)<\\/[^>]+>")
@JvmStatic
fun main(args: Array<String>) {
mergeDuplicates()
@Romain-P
Romain-P / async_socket.h
Last active June 7, 2020 12:55
non-blocking sockets
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <vector>
#include <string>
#include <iostream>
namespace AsyncSocket {
inline std::vector<WSAPOLLFD> watchList;
package fr.romain.ass3.persist;
import android.content.Context;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import fr.romain.ass3.MainActivity;
public final class LocalStorage {
@Romain-P
Romain-P / internal.cpp
Last active March 28, 2019 23:29
segfault
namespace utf8
{
// The typedefs for 8-bit, 16-bit and 32-bit unsigned integers
// You may need to change them to match your system.
// These typedefs have the same names as ones from cstdint, or boost/cstdint
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
// Helper code - not intended to be directly called by the library users. May be changed at any time