Skip to content

Instantly share code, notes, and snippets.

View EduardoSimon's full-sized avatar
🥝

Eduardo Simón Picón EduardoSimon

🥝
View GitHub Profile
@calexandre
calexandre / merge-zsh-history.sh
Last active May 31, 2024 06:33
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@kuroski
kuroski / camelCase-snake_case-types.ts
Last active June 13, 2024 04:39
Typescript type camelCase / snake_case conversion
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}`
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
: Lowercase<S>
type KeysToCamelCase<T> = {
[K in keyof T as CamelCase<string & K>]: T[K]
}
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ?