Skip to content

Instantly share code, notes, and snippets.

View ak2k's full-sized avatar

Adam ak2k

  • New York, NY
View GitHub Profile
@rasmus-kirk
rasmus-kirk / nix-markdown-pandoc.nix
Last active September 9, 2024 13:11
A report built with Pandoc, with continious compilation
{
description = "A report built with Pandoc, with continious compilation.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
@jart
jart / rename-pictures.sh
Created December 12, 2023 15:24
Shell script for renaming all images in a folder
#!/bin/sh
# rename-pictures.sh
# Author: Justine Tunney <[email protected]>
# License: Apache 2.0
#
# This shell script can be used to ensure all the images in a folder
# have good descriptive filenames that are written in English. It's
# based on the Mistral 7b and LLaVA v1.5 models.
#
# For example, the following command:
@scyto
scyto / proxmox-tb-net.md
Last active May 3, 2025 14:50
Thunderbolt Networking Setup

Thunderbolt Networking

this gist is part of this series

you wil need proxmox kernel 6.2.16-14-pve or higher.

Load Kernel Modules

  • add thunderbolt and thunderbolt-net kernel modules (this must be done all nodes - yes i know it can sometimes work withoutm but the thuderbolt-net one has interesting behaviou' so do as i say - add both ;-)
    1. nano /etc/modules add modules at bottom of file, one on each line
  1. save using x then y then enter
parted /dev/vda -- mklabel gpt
parted /dev/vda -- mkpart primary 1GiB -8GiB
parted /dev/vda -- mkpart primary linux-swap -8GiB 100%
parted /dev/vda -- mkpart ESP fat32 1MiB 512MiB
parted /dev/vda -- set 3 esp on
mkfs.ext4 -L nixos /dev/vda1
mkswap -L swap /dev/vda2
mkfs.fat -F 32 -n boot /dev/vda3
@ghuntley
ghuntley / README.md
Last active May 4, 2023 21:16
a rough prototype for running coder.com as a nixos system service

background

  1. Now that coder is in nixpkgs at https://search.nixos.org/packages?channel=22.11&show=coder&from=0&size=50&sort=relevance&type=packages&query=coder
  2. The next step is to enable running coder in NixOS via services.coder.enable = true;
  3. Thus design configuration options such as https://search.nixos.org/options?channel=22.11&show=services.znc.user&from=0&size=50&sort=relevance&type=packages&query=znc
  4. Refer to https://github.com/NixOS/nixpkgs/blob/nixos-22.11/nixos/modules/services/networking/znc/default.nix for an example of what is to be achieved.

next steps

  1. What configuration options should we expose vs encouraging usage of extraFlags?
@bsag
bsag / README.md
Last active October 14, 2024 03:33
Selected files from my standalone Nix/Home Manager set up on macOS to illustrate the general approach

These files illustrate the way that I have set up Nix and Home Manager for standalone use on macOS on both an Intel and Apple Silicon machine, in case the examples are useful to anyone. Some of the configuration is separated out into separate files in configs/ which get imported in home.nix. Some of my existing dotfiles are placed in dotfiles/ and then symlinked in by Nix to the location that that the system expects to find them.

It is a work in progress so currently I am handling installation of R separately.

# The investment universe consists of 24 commodity futures, 12 cross-currency pairs (with 9 underlying currencies), 9 developed equity indices, and 13
# government bond futures.
# Every month, the investor considers whether the excess return of each asset over the past 12 months is positive or negative and goes long on the
# contract if it is positive and short if negative. The position size is set to be inversely proportional to the instrument’s volatility. A univariate
# GARCH model is used to estimated ex-ante volatility in the source paper. However, other simple models could probably be easily used with good results
# (for example, the easiest one would be using historical volatility instead of estimated volatility). The portfolio is rebalanced monthly.
# QC implementation changes:
# instead of GARCH model volatility, simple historical volatility is used in this code.
# for more info on trading strategies visit miltonfmr.com
@convexset
convexset / remove-pdf-watermark.sh
Last active January 1, 2025 05:42
Remove multiple text watermarks from a PDF file. Requires xxd and qpdf to work correctly.
#!/bin/bash
# Remove multiple text watermarks from a PDF file. Requires xxd and qpdf to work correctly.
#
# Usage:
#
# remove-pdf-watermark.sh "Your Input File.pdf" "Your Output File.pdf" [WATERMARK1] [WATERMARK2] [WATERMARK3] [...]
#
# For Example:
#
@henrik242
henrik242 / airtag-to-gpx-sync.sh
Last active April 19, 2025 20:26
Read AirTag data from the FindMy.app cache and convert to GPX
#!/usr/bin/env bash
#
# Reads AirTag data from the FindMy.app cache and converts it to a daily GPX file
#
# Rsyncs the data to a web accessible folder that can be displayed with e.g.
# https://gist.github.com/henrik242/84ad80dd2170385fe819df1d40224cc4
#
# This should typically be run as a cron job
#
@rjzamora
rjzamora / remote_parquet_benchmark.py
Created March 21, 2022 18:15
Simple benchmark to measure the performance of fsspec.parquet.read_parquet_file for a single-column read.
import time
import argparse
try:
import cudf
except ImportError:
cudf = None
import pandas as pd
import numpy as np