Skip to content

Instantly share code, notes, and snippets.

View PgBiel's full-sized avatar
💭
programming

PgBiel

💭
programming
View GitHub Profile
@PgBiel
PgBiel / how-i-would-improve-nixos.md
Last active August 22, 2024 22:18
How I would improve NixOS

How I would improve NixOS (2024-08-22)

Hello! I'm Pg (GitHub: PgBiel). I wanted to share some thoughts about NixOS and Linux to the world - originally to the Gleam community, but this got a bit longer than I expected, so I made this Gist.

Normally this would be a blog post or similar, but I don't have a blog at the moment and I really wanted to write this down, so a Gist will do for now :)

I'll assume the reader is minimally familiar with concepts related to Linux distributions. You can learn more about NixOS here: https://nixos.org/

Observations

@PgBiel
PgBiel / only-number-labeled.typ
Last active April 30, 2024 04:04
Typst - Only number labeled equations
// MIT No Attribution
//
// Copyright (c) 2023 Pg Biel
//
// 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.
//
@PgBiel
PgBiel / stick-together.typ
Last active March 21, 2024 14:10
Typst - Try to keep two things in the same page
// MIT No Attribution
//
// Copyright (c) 2023 Pg Biel
//
// 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.
//
@PgBiel
PgBiel / gdext-wasm-min-report.md
Last active January 31, 2024 03:02
Gdext WebAssembly Experiment #1

Everything below was tested with Godot 4.1.1, gdext at commit master@639aeb495f8f43fe68a326f6abe70a8ce4694ce3, Rust v1.72.0 (when using the stable channel), Rust v1.74.0-nightly (5ae769f06 2023-09-26, when using the nightly channel) and emsdk v3.1.28, in a Debian 12 podman container.

  1. Setup: So far, to reach the furthest progress I could find in gdext WebAssembly export, it seems you need at least to:
    1. Use the Emscripten flags --no-entry -sSIDE_MODULE=2 -sUSE_PTHREADS=1 (last one appears to be superseded by -pthread on recent versions);
      • To apply those flags, one can add to the env var RUSTFLAGS -C link-arg=emscripten-flag-here for each emscripten flag.
      • You can also avoid having to use RUSTFLAGS by adding the flags to project/rust/.cargo/config.toml in the format
      [target.wasm32-unknown-emscripten]
      rustflags = [
          "-Clink-arg=--no-entry",
@PgBiel
PgBiel / ref-enum-item.typ
Last active October 28, 2024 14:40
Referencing enum items in Typst 0.8.0
// MIT No Attribution
//
// Copyright (c) 2023 Pg Biel
//
// 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.
//
@PgBiel
PgBiel / bruh_moment.py
Created December 7, 2019 04:11
bruh moment
print("bruh moment")
@PgBiel
PgBiel / manim_util.py
Last active June 11, 2020 03:43
Manim utilities
from manimlib.imports import *
import typing
import itertools
import collections
def set_colors(obj: typing.Union[Mobject, Group, typing.Sequence], colors: typing.List[str]) -> object:
for ind, color in zip(enumerate(obj), colors):
obj[ind[0]].set_color(color)
return object
@PgBiel
PgBiel / quickRenamer.js
Created April 13, 2017 09:27
Quick Renaming of files of a directory (Node 7+)
if (require.main !== module) throw new Error("Must not be require()d");
const fs = require("fs");
process.stdin.setEncoding("utf8");
process.openStdin();
const promisifyEvent = (emitter, event, handler, onOnce) => {
return new Promise((res, rej) => {
const newFunc = function() {
const args = Array.from(arguments);
res(handler.apply(handler, args));
};