Skip to content

Instantly share code, notes, and snippets.

@oidualc
oidualc / debounce.ts
Created March 22, 2023 09:45
debounce.ts
export function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>(
func: F,
waitFor: number
): (...args: Parameters<F>) => void {
let timeout: ReturnType<typeof setTimeout>;
return (...args: Parameters<F>) => {
clearTimeout(timeout);
timeout = setTimeout(() => func(...args), waitFor);
};
@oidualc
oidualc / gist:1b4f9d3fcd7c0685daa33ded12231b2d
Created December 7, 2022 22:15
expose wsl to local network
powershell.exe -noprofile -executionpolicy bypass -file script.ps1
https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
@oidualc
oidualc / timer.py
Last active August 11, 2022 10:07
Timer functions Python
from time import perf_counter
from typing import Any, Callable, Coroutine, ParamSpec, TypeVar
T = TypeVar("T")
P = ParamSpec("P")
def with_timer(fn: Callable[P, T]) -> Callable[P, T]:
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
t0 = perf_counter()
result = fn(*args, **kwargs)
@oidualc
oidualc / tar_untar.md
Created June 1, 2022 09:55
tar/untar zstd

Tar file with multi threaded zstd

tar -c -f directory.tar.zst -I "zstd -T16" directory

Untar file with multi threaded zstd

tar -x -f directory.tar.zst -I "unzstd -T16"
@oidualc
oidualc / .npmrc
Last active May 20, 2022 13:49
.npmrc
audit=false
fund=false
@oidualc
oidualc / .gitconfig
Last active April 7, 2024 09:19
My git configuration
[credential]
helper = store
[alias]
stash-unapply = !git stash show -p | git apply -R
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
co = checkout
br = branch
ci = commit
st = status
unstage = reset HEAD
@oidualc
oidualc / .vimrc
Last active December 8, 2021 16:19
My vim configuration
call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
call plug#end()
let g:airline_powerline_fonts = 1
syntax on
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
@oidualc
oidualc / fix-cordova-6.4.0-semver.patch
Last active December 11, 2020 23:59
Fix for semver error in cordova 6.4.0
--- a/platforms/android/cordova/lib/emulator.js 2018-08-08 12:34:38.000000000 +0200
+++ b/platforms/android/cordova/lib/emulator.js 2018-08-08 14:14:35.000000000 +0200
@@ -187,7 +187,7 @@
var api_level = avd.target.match(/\d+/);
if (api_level) {
var level = android_versions.get(api_level);
- avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
+ avd.target = 'Android ' + (level ? level.semver : '') + ' (API level ' + api_level + ')';
}
}
@oidualc
oidualc / userChrome.css
Last active February 7, 2020 20:27
Firefox Client Side Decorations: close, minimize, maximize on the left
#TabsToolbar {
direction: rtl;
}
#tabbrowser-tabs {
direction: ltr;
}
.titlebar-buttonbox {
display: flex;