This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Help: https://stackoverflow.com/questions/72852736/generating-swagger-json-file-without-running-nest-js-server | |
// NestJS 11 | |
import * as path from 'path'; | |
import { writeFileSync } from 'fs'; | |
import { DataType, newDb } from 'pg-mem'; | |
import { DataSource } from 'typeorm'; | |
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; | |
import { Test } from '@nestjs/testing'; | |
import { AppModule } from '../src/app.module'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script ensures you don't commit/push with the wrong git identity. My remotes are like this: gitperso:iTrooz/repo.git, gitschool:SomeUser/repo.git | |
# This script should be installed as both pre-commit and pre-push hook (symlink it) | |
# To use it as a global hook, see https://gist.github.com/iTrooz/551f779af2096912baa9d2e395e2642a | |
verify_author() { | |
local author="$1" | |
local url="$2" | |
case "$url" in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script sets up global git hooks (for global actions), that by default forward to local repository hooks if they exist. | |
# You can then edit these global hooks (make sure to keep the forwarding logic !) | |
HOOKS="applypatch-msg fsmonitor-watchman prepare-commit-msg pre-receive update post-update pre-commit pre-push push-to-checkout commit-msg pre-applypatch pre-merge-commit pre-rebase sendemail-validate" | |
HOOKS_DIR="$HOME/.config/git/hooks" | |
mkdir -p "$HOOKS_DIR" | |
git config --global core.hooksPath "$HOOKS_DIR" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Error handling based on thiserror type, with a variant to catch "all other errors" using anyhow. | |
use std::fs::read_to_string; | |
#[derive(thiserror::Error, Debug)] | |
pub enum MyError { | |
#[error("some other error")] | |
FileNotFound, | |
#[error("anyhow error: {0}")] | |
Anyhow(#[from] anyhow::Error), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Find words that can be typed in the same way from azerty and qwerty keyboards (e.g. for early boot password prompts) | |
A="azertyuiopqsdfghjklmwxcvbn" | |
Q="qwertyuiopasdfghjkl;zxcvbn" | |
# Common letters: ['e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'x', 'c', 'v', 'b', 'n'] | |
common = [] | |
for a, q in zip(A, Q): | |
if a == q: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wdym structs and classes have different assignment semantics, and it still persists with protocols ?? | |
protocol P { | |
var data: Int { get set } | |
} | |
struct A: P { | |
var data = 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Generation] | |
[Generation.Dragon] | |
#Whether to generate dragon skeletons or not | |
"Generate Dragon Skeletons" = true | |
#1 out of this number chance per chunk for generation | |
#Range: 1 ~ 10000 | |
"Generate Dragon Skeleton Chance" = 300 | |
#1 out of this number chance per chunk for generation | |
#Range: 1 ~ 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
output = os.popen('git shortlog -s -n').read() | |
lines = {} | |
for line in output.split("\n"): | |
if not line: | |
continue |
NewerOlder