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
### | |
# Copyright (c) 2014, Jari Vetoniemi | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# * Redistributions of source code must retain the above copyright notice, | |
# this list of conditions, and the following disclaimer. | |
# * Redistributions in binary form must reproduce the above copyright notice, |
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? |
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 |
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 | |
}: |
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}" |
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, |
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="$@" |
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, |
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); |
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))); |
NewerOlder