Skip to content

Instantly share code, notes, and snippets.

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@grinsted
grinsted / drumkit_split64.py
Last active April 18, 2021 22:14
Tool for quickly making drumkits for the novation circuit
# This file contains code to save 64 samples as a syx file for Novation Circuit
#
# * It reads a single long wave file.
# * splits it into 64 equal chunks
# * crops the sound
# * adds a super fast fadein and "an appropriate fadeout". To remove clicks
# * normalizes every sample
# * Saves the whole thing as a syx file.
#
@MarioHewardt
MarioHewardt / enable_ebpf_on_wsl2
Last active April 27, 2024 09:27
Enable EBPF on WSL2
By default, EBPF programs will not run on WSL2 due to required kernel modules missing. The following example error is an
indication of this problem:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microso
ft-standard/modules.dep.bin'
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.84-microsoft-standard
chdir(/lib/modules/4.19.84-microsoft-standard/build): No such file or directory
To fix this you need to rebuild the WSL2 kernel with the missing kernel modules. The below instructions are for Ubuntu 18.04 WSL2.
1. git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@beardicus
beardicus / plotter-pen-adapter.jscad
Last active March 6, 2024 22:23
Plotter Pen Adapter for use with OpenJSCAD
// title : Plotter Pen Adapter
// author : Brian Boucheron <brian@boucheron.org>
// license : MIT License
// revision : 0.003
// date : June 9 2022
// file : plotter-pen-adapter.jscad
// gist : https://gist.github.com/beardicus/d668c0f6b96be53d16dc
// A parametric version of the plotter pen adapter found here:
// https://www.printables.com/model/156721-sharpie-fine-point-plotter-adapter
@Bekbolatov
Bekbolatov / tmux.md
Last active March 7, 2024 01:18
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@nylki
nylki / char-rnn recipes.md
Last active March 16, 2024 15:13
char-rnn cooking recipes

do androids dream of cooking?

The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.

The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.

@kouk
kouk / tmxsync.sh
Last active April 6, 2023 20:52
tmux synchronize-windows
# tmxsync: bring all windows as panes into one window and activate the "synchronize-panes" option
# tmxunsync: split all panes into different windows and deactivate the "synchronize-panes" option.
# Licence:
# To the extent possible under law I, Konstantinos Koukopoulos, have waived all copyright and related or neighboring rights to tmxsync.sh, as describe by the CC0 document:
# http://creativecommons.org/publicdomain/zero/1.0/
# This work is published from: Greece.
tmxsync () {
export _TMUX_SYNC=1;
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
anonymous
anonymous / gist:8327328
Created January 9, 2014 00:27
gif code!!!!!
int samplesPerFrame = 32;
int numFrames = 42;
float shutterAngle = .8;
int[][] result;
float time;
float d1, d2, th, pp = .7, t, tt;
int N = 10, M = 9;