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]}
@xobs
xobs / crc32.c
Last active June 23, 2025 00:57
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifdef CRC32_FAST
static const unsigned int crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
@nicholastay
nicholastay / alsong.py
Created January 10, 2019 13:00
ALSong lyrics plugin for MusicBrainz Picard (warn: getting lyrics is synchronous, so UI will be locked)
PLUGIN_NAME = 'ALSong Lyrics'
PLUGIN_AUTHOR = 'Nicholas Tay (nexerq)'
PLUGIN_DESCRIPTION = 'Gets lyric data from ALSong API.'
PLUGIN_VERSION = '0.1.0'
PLUGIN_API_VERSIONS = ['2.0']
PLUGIN_LICENSE = 'Zlib'
# Based on musixmatch plugin as a starting point
from picard.metadata import register_track_metadata_processor
from picard.file import File
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();