Skip to content

Instantly share code, notes, and snippets.

const MAX_CONCURRENCY = 2;
const useTaskQueue = () => {
const triggers = useRef<Function[]>([]);
const runningTasksRef = useRef(new Set<Function>());
const dispatchTriggers = useCallback(() => {
const runningTaskSize = runningTasksRef.current.size;
if (runningTaskSize >= MAX_CONCURRENCY) return;
@nemolize
nemolize / init-mise-with-zplug.zsh
Last active May 13, 2024 02:37
Initialize `mise` with zplug example script
# Initialize `mise` with zplug example script
# https://mise.jdx.dev/
if ! type "mise" > /dev/null; then
echo "mise is not installed. Installing mise..."
curl https://mise.run | sh
fi
eval "$(~/.local/bin/mise activate zsh)"
if ! mise which usage > /dev/null 2>&1; then
echo "mise usage is not installed. Installing usage with mise..."
@nemolize
nemolize / minist-10-samples.ipynb
Created September 25, 2023 12:59
minist-10-samples.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nemolize
nemolize / minist.ipynb
Created September 25, 2023 12:45
MINIST.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nemolize
nemolize / take-nth-of-grouped-args.sh
Last active July 4, 2022 03:29
Example of arg splitting for parallel execution
#!/usr/bin/env bash
ARGS='a b c d e' # replace this with your test file paths
GROUP_SIZE=2
NTH_OF_GROUPS=2
# outputs "c d"
echo "${ARGS}" | xargs -n "${GROUP_SIZE}" echo | sed -n "${NTH_OF_GROUPS}p"
@nemolize
nemolize / homebrew-permissions-issue.md
Created March 6, 2022 17:06 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@nemolize
nemolize / grayscale.glsl
Created February 20, 2022 17:03
Gray scale window fragment GLSL shader works with Picom compositor
/* To get this shader working, Run picom like the following
picom --glx-fshader-win "$(cat ~/.config/picom/gs.glsl)"
NOTE: You need to set the backend to "glx" to get this working.
*/
uniform float opacity;
uniform bool invert_color;
uniform sampler2D tex;
void main() {
@nemolize
nemolize / system-auth
Last active February 4, 2024 07:14
This setting enables linux login with your U2F device
#%PAM-1.0
auth required pam_faillock.so preauth
# Optionally use requisite above if you do not want to prompt for the password
# on locked accounts.
# The following 2 lines enables you to login with both Yubikey and password
# Thanks: https://cromwell-intl.com/cybersecurity/yubikey/pam_u2f.html
auth sufficient pam_unix.so try_first_pass nullok
auth sufficient pam_u2f.so cue
@nemolize
nemolize / fix-php-build-error.sh
Created December 1, 2021 02:10
Workaround if PHP 7.4.7 installation with phpenv fails with "error: ‘TRUE’ undeclared (first use in this function)"
# Ref: https://zenn.dev/kumamidori/articles/b6f79df64753bb
export CFLAGS="-Wno-error=implicit-function-declaration -DU_DEFINE_FALSE_AND_TRUE=1"
export CXXFLAGS="-Wno-error=implicit-function-declaration -DU_DEFINE_FALSE_AND_TRUE=1"
@nemolize
nemolize / idea.properties
Created November 23, 2021 17:37
Use Windows keys as Meta keys in JetBrains IDEs
# custom IntelliJ IDEA properties
# NOTE: specify the following property to use windows keys as meta keys. see https://youtrack.jetbrains.com/issue/IDEA-144702
keymap.windows.as.meta=true