Skip to content

Instantly share code, notes, and snippets.

View idoleat's full-sized avatar
🛌
zzZ

C.W. Chien idoleat

🛌
zzZ
View GitHub Profile
@kprotty
kprotty / lz4_block.zig
Last active January 2, 2024 11:14
Simple LZ4 block enc/dec in 100 LOC
const assert = @import("std").debug.assert;
fn compressBlock(writer: anytype, src: []const u8) !void {
var table = [_]u32{0} ** 4096; // size is pow2. bump to match more. ideal = (0xffff+1) / sizeof(u32)
var anchor: u32 = 0;
if (src.len > 12) { // LZ4 spec restriction: last match must start 12b before end of block.
var pos: u32 = 0;
while (pos + 4 < src.len - 5) { // LZ4 spec restriction: last 5b are always literal.
const blk: u32 = @bitCast(src[pos..][0..4].*);
@zhanghai
zhanghai / PKGBUILD
Created August 29, 2021 10:30
ibus 1.5.25-2 PKGBUILD with candidate panel position fix
# Maintainer: Felix Yan <[email protected]>
pkgbase=ibus
pkgname=(ibus libibus)
pkgver=1.5.25
pkgrel=2
pkgdesc="Next Generation Input Bus for Linux"
arch=('x86_64')
url="https://github.com/ibus/ibus/wiki"
license=('LGPL')
@akihikodaki
akihikodaki / README.en.md
Last active April 14, 2025 16:19
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@pastleo
pastleo / create_arch_media.sh
Last active June 19, 2021 10:16
create archlinux installation media
#!/bin/bash
set -e
# https://wiki.archlinux.org/index.php/USB_flash_installation_medium#Using_manual_formatting
# https://unix.stackexchange.com/questions/38164/create-partition-aligned-using-parted/49274#49274
# https://wiki.archlinux.org/index.php/Parted
# https://wiki.archlinux.org/index.php/Syslinux#Manual_install
# Preparation:
shader_type canvas_item;
uniform sampler2D spritesheet; // Should be a slice image as exported from Magica Voxel
uniform int slice_count = 1; // The number of slices
uniform vec2 camera_vec = vec2( 1., 1. ); // Recomend using (1,1) or (1,1.5)
uniform float camera_ang = 0.0; // change this to change the view angle of the object
uniform bool flip_stack_order = true;
const int MAX_SLICE_COUNT = 1000;
shader_type canvas_item;
uniform sampler2D spritesheet; // Should be a slice image as exported from Magica Voxel
uniform int slice_count = 1; // The number of slices
uniform vec2 camera_vec = vec2( 1., 1. ); // Recomend using (1,1) or (1,1.5)
uniform float camera_ang = 0.0; // change this to change the view angle of the object
const vec2 center = vec2( 0.5 );
bool scale_and_rotate_with_offset( inout vec2 uv, vec2 sxy, float ang, vec2 cent, vec2 offset )
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
char pikachu0[] =
""ANSI_BG_GREEN".......***.................................................."ANSI_RESET"\n"
""ANSI_BG_GREEN".......****................................................."ANSI_RESET"\n"
""ANSI_BG_GREEN".......***."ANSI_BG_YELLOW" "ANSI_BG_GREEN"................................................"ANSI_RESET"\n"
""ANSI_BG_GREEN"......****."ANSI_BG_YELLOW" "ANSI_BG_GREEN".............................................."ANSI_RESET"\n"
""ANSI_BG_GREEN".........*."ANSI_BG_YELLOW" "ANSI_BG_GREEN"............................................"ANSI_RESET"\n"
""ANSI_BG_GREEN".........*."ANSI_BG_YELLOW" "ANSI_BG_GREEN"............................***********.."ANSI_BG_YELLOW" "ANSI_RESET"\n"
""ANSI_BG_GREEN"..........*"ANSI_BG_YELLOW" "ANSI_BG_GREEN"...........................********.."ANSI_BG_YELLOW" "ANSI_RESET"\n"
""ANSI_BG_GREEN"..........*."ANSI_BG_YELLOW" "ANSI_BG_GREEN".........................******.."ANSI_BG_YELLOW" "ANSI_RESET"\n"
""ANSI_BG_GREEN"..
@mxmilkiib
mxmilkiib / lv2-over1200-uri-list
Last active March 9, 2025 17:21
Over 1200 LV2 plugins. Almost all are available in the AUR for Arch Linux/Manjaro/pacman distributions. Note URIs are normally only used internally in hosts.
# IFS=$'\n' arr=($(lv2ls)) && IFS=$'\n' arr2=($(lv2ls -n)) && for (( i=0; i<${#arr[*]}; ++i)); do printf "%s|%s\n" "${arr[$i]}" "${arr2[$i]}"; done | column -t -s "|"
file:///usr/lib/lv2/audio_to_audio.ingen/main.ttl audio_to_audio
file:///usr/lib/lv2/control_to_control.ingen/main.ttl control_to_control
file:///usr/lib/lv2/cv_to_cv.ingen/main.ttl cv_to_cv
file:///usr/lib/lv2/event_to_event.ingen/main.ttl event_to_event
file:///usr/lib/lv2/gen_amsynth_filte_out.ingen/main.ttl gen_amsynth_filte_out
file:///usr/lib/lv2/MonoEffect.ingen/MonoEffect.ttl Ingen Mono Effect Template
file:///usr/lib/lv2/MonoInstrument.ingen/MonoInstrument.ttl Ingen Mono Instrument Template
file:///usr/lib/lv2/StereoEffect.ingen/StereoEffect.ttl Ingen Stereo Effect Template
file:///usr/lib/lv2/StereoInstrument.ingen/StereoInstrument.ttl