Skip to content

Instantly share code, notes, and snippets.

@paralin
paralin / Go Git CLI Extensions
Last active July 13, 2024 20:34
git utilities written in Go
Copyright 2024 Christian Stewart <christian@aperture.us>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH
@sikanhe
sikanhe / ReactCompilerPlugin.ts
Last active July 1, 2024 19:05
React Compiler plugin for ESBuild
import { readFileSync } from "node:fs"
import * as babel from "@babel/core"
import BabelPluginReactCompiler from "babel-plugin-react-compiler"
import type { Plugin } from "esbuild"
import QuickLRU from "quick-lru"
export function ReactCompilerEsbuildPlugin({
filter,
sourceMaps,
runtimeModulePath,
@paralin
paralin / minimize-go-wasm-size.md
Last active June 6, 2024 20:53
Minimizing Go wasm binaries size: a multi-pronged approach

My approach to smaller Go wasm binaries:

  • protoc-gen-go-lite: Removes dependency on reflection, making your binaries lighter.
  • goweight: Analyze the size of your binaries. This is a fork with added wasm support.
  • goda: Use to find why something is imported by executing:
    goda graph "reach(.:all, gonum.org/v1/gonum/mat)" | dot -Tsvg -o graph.svg
    
  • wasm-opt: Optimize wasm binaries for size with the command:
@q3k
q3k / hashes.txt
Last active May 16, 2024 16:49
liblzma backdoor strings extracted from 5.6.1 (from a built-in trie)
0810 b' from '
0678 b' ssh2'
00d8 b'%.48s:%.48s():%d (pid=%ld)\x00'
0708 b'%s'
0108 b'/usr/sbin/sshd\x00'
0870 b'Accepted password for '
01a0 b'Accepted publickey for '
0c40 b'BN_bin2bn\x00'
06d0 b'BN_bn2bin\x00'
0958 b'BN_dup\x00'
@thesamesam
thesamesam / xz-backdoor.md
Last active July 25, 2024 09:00
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@paralin
paralin / x2x-on-macos.md
Created December 27, 2023 22:56
x2x on MacOS

X2X on MacOS

It works! Sort of.

Using X2X from MacOS

  1. Install XQuartz
  2. Set up your Linux host with X11, x2x, and a SSH server.
  3. Add your host to ~/.ssh/config so you can use ssh myhost to connect.
  4. Open XQuartz. Select in the top menu: Applications -> Terminal
@paralin
paralin / gist:d4acde4dae926d62fc56169be3cb27f4
Created August 23, 2023 22:00
llama.cpp docker cublas make it go fast
docker rm -f rocm
sudo docker run -d \
--name=rocm \
--privileged \
-v /dev:/dev \
-v /mnt/persist/work/rocm:/home/rocm-user \
--security-opt seccomp=unconfined \
--group-add video \
rocm/rocm-terminal \
bash -c "sleep infinity"
@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active July 1, 2024 05:32
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@TinHead
TinHead / shell.nix
Last active November 17, 2022 01:26
my nix-shell attempt
{ pkgs ? import <nixpkgs> { } }:
let
fhs = pkgs.buildFHSUserEnvBubblewrap {
name = "SkiffOS-fhs";
targetPkgs = pkgs: (with pkgs;
[
bc
binutils
bzip2
@Med-H
Med-H / esbuild.md
Last active November 29, 2023 10:03
esbuild with hot reload, typescript server as well as eslint server

An extremely fast JavaScript bundler written in Go.

structure path

  • public
    • favicon.ico
    • locales
  • ...