View zig-stdenv.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib, stdenv ? pkgs.stdenv, zig ? pkgs.zig, static ? true, target }: | |
with lib; | |
with builtins; | |
# Zig based cross-compiling toolchain | |
# | |
# Major known issues: | |
# - Zig seems to randomly fail with parallel builds with 'error: unable to build ... CRT file: BuildingLibCObjectFailed' | |
# This seems like race condition with the cache? |
View default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MIT License, see below | |
# | |
# These are some helpers for figuring out the derivations attributes of runtime | |
# dependencies of a derivation, in particular the function `runtimeReport`. At | |
# the bottom of the file you can see it used on `hello`. Spoiler: glibc is a | |
# runtime dependency. | |
# For more info see | |
# | |
# https://nmattia.com/posts/2019-10-08-runtime-dependencies.html |
View invokeai.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {} | |
, lib ? pkgs.lib | |
, stdenv ? pkgs.stdenv | |
, fetchurl ? pkgs.fetchurl | |
, runCommand ? pkgs.runCommand | |
, makeWrapper ? pkgs.makeWrapper | |
, mkShell ? pkgs.mkShell | |
, installationPath ? (builtins.toString ./.) + "/.conda" | |
, frameworks ? pkgs.darwin.apple_sdk.frameworks | |
}: |
View git-archive-all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Archive git project including all submodules | |
# Usage: git archive-all <name> <ref> | |
set -eEuo pipefail | |
current="$(git rev-parse --abbrev-ref HEAD)" | |
toplevel="$(git rev-parse --show-toplevel)" | |
toplevel="${toplevel##*/}" | |
name="${1:-$toplevel}" |
View packet.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
enum packet_type { | |
PACKET_IOCTL, | |
PACKET_WRITE, | |
}; | |
enum ioctl_dir { | |
IOCTL_NONE, | |
IOCTL_IOR, |
View fakepkg.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Fake makepkg enough to build and install android-protobuf PKGBUILD | |
# Go into sanity mode | |
set -eEuo pipefail | |
# Heuristics, do your job if not true. | |
PROTOC="$(which protoc)" | |
MAKEFLAGS="$@" |
View xic.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* tcc -std=c99 xic.c -o xic | |
* | |
* Tool to compress/decompress FFXI server messages. | |
* | |
* I'm not sure what the algorithm is, but it seems to work on separate encoding and | |
* decoding tables. (It seems to be some sort of cumulative substitution coder) | |
* | |
* At most encoding outputs 8 times bigger buffer than original for decoding. | |
* However this buffer is mostly zeros and needs to be only expanded during decoding, |
View fizz-enterprise-w-numbers.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
void main(void) | |
{ | |
char num[4]; | |
const char *lut[] = { num, "Fizz\n", "Buff\n", "FizzBuff\n" }; | |
for (uint32_t i = 1; i <= 100; ++i) { | |
const uint8_t n = !(i % 3) + (2 * !(i % 5)); | |
snprintf(num, sizeof(num), "%d\n", i); |
View bitrot.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <limits.h> | |
#include <assert.h> | |
static void | |
print_bits(uint32_t v) | |
{ | |
for (uint32_t i = 0; i < sizeof(v) * CHAR_BIT; ++i) | |
printf("%u", !!(v & (1<<i))); |
View migrate_db.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Migrate database automatically. | |
# | |
# Automatically migrates between schema changes. | |
# Where fields were either added or removed. | |
# | |
# However does not understand, if field names were renamed. | |
# You stil have to manually migrate those (eg. linkshellid1 -> linkshellid) | |
# These fields should show up as "old fields" and "new fields" in stdout. | |
# |
NewerOlder