Skip to content

Instantly share code, notes, and snippets.

View davidonlaptop's full-sized avatar

David Lauzon davidonlaptop

View GitHub Profile
@davidonlaptop
davidonlaptop / aws.md
Created August 22, 2023 14:17
AWS Shortcuts

‎‎​

@davidonlaptop
davidonlaptop / typescript-hacks.md
Last active July 30, 2023 20:26
typescript-hacks

Typescript Hacks

Tuples

Variadic Tuple using Spread operator

Plain typescript

type VariadicTuple = [string, ...number[]];
@davidonlaptop
davidonlaptop / .vscode-ts-jest-launch.json
Last active August 13, 2023 20:12
Visual Studio Code Hacks
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug a Jest file from a module in Git Subfolder",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/SUBFOLDER",
"runtimeArgs": [
"--inspect-brk", "${workspaceRoot}/SUBFOLDER/node_modules/.bin/jest",
@davidonlaptop
davidonlaptop / import-git-subfolder.md
Last active July 18, 2022 03:39
Import git subfolder into another repository with history (2022)

1. Install git-filter-repo

brew install git-filter-repo
# or just download the single python file

2. Clone fresh copy of both of your repo (in case you mess up)

git clone git@github.com:YOUR_ORGANIZATION/repo1.git tmprepo1
git clone git@github.com:YOUR_ORGANIZATION/repo2.git tmprepo2
@davidonlaptop
davidonlaptop / athena.properties
Created March 22, 2022 20:01
Generate Athena database documentation with SchemaSpy
description=AWS Athena
type=athena
driver=com.simba.athena.jdbc42.Driver
connectionSpec=jdbc:awsathena://athena.<region>.amazonaws.com:443;S3OutputLocation=<S3OutputLocation>
# eg: region=ca-central-1
tableTypes=TABLES,TABLE,MANAGED_TABLE,EXTERNAL_TABLE
@davidonlaptop
davidonlaptop / FastestRemoteRsyncSSH.md
Last active November 19, 2018 23:17 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@davidonlaptop
davidonlaptop / index.html
Created March 13, 2018 20:10
Render XLSX within the browser
<style type="text/css">
html,
body,
iframe {
width: 100%;
height: 100%;
}
</style>
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=https://download.microsoft.com/download/1/4/E/14EDED28-6C58-4055-A65C-23B4DA81C4DE/Products.xlsx' width='100%' height='100%' frameborder='0'>
@davidonlaptop
davidonlaptop / merge-git-repo.sh
Last active March 6, 2018 19:34
Merges multiple git repositories into a single one
#!/bin/bash
# See: https://stackoverflow.com/questions/1683531/how-to-import-existing-git-repository-into-another
# https://help.github.com/articles/about-git-subtree-merges/
# https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt
# https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging
# git filter-branch
# git read-tree
# https://unix.stackexchange.com/questions/280217/how-to-replay-git-repository-history-into-subdirectory
@davidonlaptop
davidonlaptop / latency.txt
Created December 1, 2015 01:07 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms