Skip to content

Instantly share code, notes, and snippets.

Cloudef / zig-stdenv.nix
Last active February 19, 2024 18:36
Zig based cross-compiling toolchain
{ 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?
hikari-no-yume / 0_hello-world.c
Last active February 24, 2021 08:26
What would C look like if you compiled it to LLVM IR and back again? (
#include <stdio.h>
int main(void)
printf("hello, world\n");
andrebrait /
Last active June 16, 2024 19:44
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have

Odkazy na statnicove otazky na Dropboxu


Níže najdete odkazy na jednotlivé státnicové otázky programu OI 2016. Odkazy vedou na Dropbox kde můžete doplňovat, komentovat atd.

Jak tisknout

V Dropbox Paper nahoře vpravo > ... > print. V nastavení tisku dejte další možnosti a dejte velikost na 80%, defaultní velikost je strašně velká. Taky doporučuji vypnout všehny informace v zápatí a záhlaví. Defaultně je tam URL, čas apod.

with import ./. {};
extraSources = [];
lib = pkgs.lib;
optionsListVisible =
lib.filter (opt: opt.visible && !opt.internal)
(lib.optionAttrSetToDocList options);
abn /
Last active December 1, 2023 14:00
Install JetBrains Toolbox App
#!/usr/bin/env bash
# Reference:
# Note that we grep for linux here, if you are using this on mac/windows please see json output
TOOLBOX_URL=$(curl --silent '' \
-H 'Origin:' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Referer:' \
egregius313 /
Last active April 18, 2024 09:43
CS 135 Scheme Cheatsheet
LnL7 / configuration.nix
Last active April 7, 2024 01:08
NixOS configuration overlays
{ config, pkgs, ... }:
# Import unstable channel.
# sudo nix-channel --add nixpkgs-unstable
# sudo nix-channel --update nixpkgs-unstable
unstable = import <nixpkgs-unstable> {};
ottidmes / premium-xcursor-theme.nix
Created July 21, 2017 01:12
Custom X cursor in NixOS
{ stdenv, lib, fetchurl, variants ? [ "Premium" "Premium-left" ] }:
with lib;
stdenv.mkDerivation rec {
name = "${package-name}-${version}";
package-name = "premium-xcursor-theme";
version = "0.3";
src = fetchurl {