Skip to content

Instantly share code, notes, and snippets.

@evanrelf
evanrelf / README.md
Last active October 9, 2023 20:45
Install NixOS on ZFS With Opt-In State

Install NixOS on ZFS With Opt-In State

Commands

# nvme0n1
# ├─nvme0n1p1    BOOT
# └─nvme0n1p2    LUKS CONTAINER
#   └─cryptroot  LUKS MAPPER
#     └─vg-swap  SWAP
@Mlocik97
Mlocik97 / Readme.md
Last active January 8, 2025 19:13
PulseEffects preset for laptops microphones

NOTE: This preset is for PE version 4.7.x

Set microphone volume at 10% (-60dB).

Put file to ~/.config/PulseEffects/input

@nuxeh
nuxeh / nixinst.sh
Created May 12, 2020 12:00
Automated NixOS installer script
#!/bin/sh
#
# For installing NixOS having booted from the minimal USB image.
#
# To run:
#
# sh -c "$(curl https://eipi.xyz/nixinst.sh)"
#
# https://eipi.xyz/blog/nixos-x86-64
@idiomer
idiomer / pyspark_hdfs_utils.py
Last active April 11, 2025 07:02
Using PySpark to handle HDFS, such as list (ls), rename (mv), delete (rm)
'''
The path is a directory by default
'''
def hdfs_list(path, subtract_one=True):
fs = spark._jvm.org.apache.hadoop.fs.FileSystem.get(spark._jsc.hadoopConfiguration())
list_status = fs.listStatus(spark._jvm.org.apache.hadoop.fs.Path(path))
# file.getPath().getName(), file.getBlockSize(), file.getLen()
files_size = [file.getLen() for file in list_status]
totol_size_in_MB = sum(files_size) / 1024.0 / 1024.0
@atheriel
atheriel / ralloc.bt
Last active April 6, 2020 12:09
Trace allocations of R vectors using bpftrace
#!/usr/bin/env bpftrace
/*
* ralloc - Print allocations of R vectors.
*
* Copyright 2020 Aaron Jacobs
* Licensed under the MIT License or the Apache License, version 2.0.
*/
BEGIN
{
@573
573 / iso-config.nix
Last active January 17, 2024 21:32
Using a nixos qemu machine for fun and profit howto, as well creating iso files.
{ pkgs, lib, ... }:
with lib;
{
config = {
i18n.defaultLocale = "de_DE.UTF-8";
time.timeZone = "Europe/Paris";
services = {
@tarnacious
tarnacious / build-qcow2.nix
Last active November 6, 2024 21:23
Build a bare bones bootable nixos qcow2 image suitable for running with libvirt/qemu/kvm.
{ config, lib, pkgs, ... }:
with lib;
{
imports =
[
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
./machine-config.nix
];
@teamblack-ci
teamblack-ci / 00-update-vault.sh
Last active July 13, 2024 09:44
Let's Encrypt certificate management using Certbot and Vault
#!/bin/sh
#
# Perform certificate updates in Vault.
set -eo pipefail
if ! vault token lookup > /dev/null; then
echo "Login to Vault first."
exit 1
fi
package org.apache.spark.countSerDe
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.types._
import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.GenericInternalRow
import org.apache.spark.sql.expressions.MutableAggregationBuffer
import org.apache.spark.sql.expressions.UserDefinedAggregateFunction
@munificent
munificent / generate.c
Last active January 27, 2025 18:14
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u