Skip to content

Instantly share code, notes, and snippets.

@thenhnn
thenhnn / opencl.patch
Created March 8, 2025 19:35
mesa-asahi-edge on latest nixpkgs
diff --git a/meson.build b/meson.build
index c150bff74ff..37fa7f0531b 100644
--- a/meson.build
+++ b/meson.build
@@ -1850,7 +1850,7 @@ endif
dep_clang = null_dep
if with_clc or with_gallium_clover
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ llvm_libdir = get_option('clang-libdir')
@aamiaa
aamiaa / RevertNewLayout.md
Last active April 24, 2025 14:08
Revert New Discord Layout

The original snippet no longer works!

On 02/09/2024 at around 8pm UTC, Discord flipped an experiment (2023-09_mobile_redesign_override_toggles) which ignores the layout toggle that this script relied on.

If you want to continue using the old layout, you can either use a modded mobile client (such as Vendetta) to disable that experiment, or downgrade to an old version of the app.

Method 1 - Downgrading (Android)

Tip

Use this one if you want a fast, beginner-friendly solution and don't mind using a version from November 2023

  1. Download version 205.15 of Discord mobile app from ApkMirror
@andyfriesen
andyfriesen / BUCK
Created July 30, 2023 17:20
Trying to work out how to get a single mega-compilation-database out of Buck. This is a pretty naive approach, but I think it works?
# compdb/BUCK
python_bootstrap_binary(
name = "combine_compdbs",
main = "combine_compdbs.py",
visibility = ["PUBLIC"]
)
@Ce11an
Ce11an / surreal.py
Last active March 6, 2023 03:07
SurrealDB WebSocket Client
"""SurrealDB websocket client library."""
import enum
import json
from types import TracebackType
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import pydantic
import websockets
@macshome
macshome / defang.md
Last active April 23, 2025 04:03
How to defang system protections on macOS

How to Defang macOS System Protections

If you want to change things on the root drive of a Mac you will need to take some steps to disable the built in security of the system. Most of these steps are the same regardless if you are on Intel or Apple Silicon. If there is a difference it is noted.

Note that all of these things put a Mac into an unsupported and less secure state.

Make sure you either perform these steps in a VM or that you reset the protections after you are done poking around

Protections and Terms

(This list is not exahustive on the details of each. Check the links at the end for more info.)

@Vogtinator
Vogtinator / README.md
Last active April 16, 2025 04:28
Run Win11 on ARM in QEMU

Guide updated to use the official installation .iso from Microsoft, which finally became available in Dec. 2024! For the VHDX disk image based guide check an earlier version of this gist.

When following this guide on a host not capable of aarch64 virtualization, replace -cpu host -accel kvm with -cpu max.

  1. Download the installation .iso from https://www.microsoft.com/en-us/software-download/windows11arm64. Win11_24H2_EnglishInternational_Arm64.iso is known to work.
  2. Download the the latest virtio-win.iso from https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/.
  3. Create a disk image for the Windows installation: qemu-img create -f qcow2 win11.qcow2 25G
  4. Start the installation with generic (ramfb for display, usb-storage for .isos) as well as virtio (virtio-gpu-pci, virtio-block) devices: `qemu-system-aarch64 -M virt -cpu host -accel kvm -m 4G -smp 4 -device ramfb -device virtio-gpu-pci -bios /usr/share/qemu/qemu-uefi-aarch64.bin -device qemu-xhci -device usb-kbd -dev
@shiryel
shiryel / nix_try_eval.patch
Last active May 29, 2024 22:51
Nixpkgs to JSON
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index bc253d0a3..e6c348d99 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -867,7 +867,7 @@ static void prim_tryEval(EvalState & state, const PosIdx pos, Value * * args, Va
state.forceValue(*args[0], pos);
attrs.insert(state.sValue, args[0]);
attrs.alloc("success").mkBool(true);
- } catch (AssertionError & e) {
+ } catch (EvalError & e) {
@marler8997
marler8997 / signing.zig
Created July 9, 2022 22:35
Generate Keys, Sign and Verify files on linux with ED25119 and BLAKE3
const std = @import("std");
const Signer = std.crypto.sign.Ed25519;
// Blake3 : 1
// Blake2b512 : 1.3 x slower than Blake3
// Sha256 : 4 x slower than Blake3
//const Hasher = std.crypto.hash.sha2.Sha256;
//const Hasher = std.crypto.hash.blake2.Blake2b512;
const Hasher = std.crypto.hash.Blake3;
@emidoots
emidoots / ramblings.md
Last active December 25, 2024 04:39
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@LiosK
LiosK / uuidv8_example.c
Last active April 3, 2024 02:11
UUIDv8 Example
#include <stdint.h>
#include <time.h>
int get_random_bytes(uint8_t *buffer, int count);
int generate_uuidv8(uint8_t *uuid, uint8_t node_id) {
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) != 0)
return -1; // real-time clock error