Skip to content

Instantly share code, notes, and snippets.

@skeeto
skeeto / README.md
Last active December 20, 2021 14:00
AI driving simulation
@kevinoid
kevinoid / .bashrc
Created July 31, 2019 16:31
GnuPG pinentry script for terminal or graphical interface based on $PINENTRY_USER_DATA.
# ~/.bashrc: executed by bash(1) for non-login shells.
# If file exists (likely) copy fragment below into existing script:
# If stdin is a terminal
if [ -t 0 ]; then
# Set GPG_TTY so gpg-agent knows where to prompt. See gpg-agent(1)
export GPG_TTY="$(tty)"
# Set PINENTRY_USER_DATA so pinentry-auto knows to present a text UI.
export PINENTRY_USER_DATA=USE_TTY=1
@AndersonTorres
AndersonTorres / nix-development-template-file.org
Last active September 27, 2021 21:01
A project workflow for Nixpkgs/NixOS

Standard project structure

This is a project structure I’ve found useful. Looking for any thoughts/comments/feedback. Roughly, I found a tension between the style nixpkgs expects and the style conducive to development, so I extracted the common portion into a derivation.nix which is used by the remaining .nix files. This setup allows me to use nix build, nix-shell, overlays, Hydra, alternate packaging schemes, cross-compiling, etc.

#! /bin/sh
nix-instantiate --find-file nixpkgs >/dev/null || {
echo "Could not find nixpkgs, please set up your NIX_PATH"
exit 1
}
NIX_DO_STASH="${NIX_DO_STASH:-$HOME/.local/share/nix-do}"
NIX_DO_PROFILE="${NIX_DO_PROFILE:-$(readlink $HOME/.nix-profile)}"
@lategoodbye
lategoodbye / mainline_guide.md
Last active January 4, 2024 21:35
Raspberry Pi: How to cross-compile and use Mainline Kernel

Raspberry Pi: How to cross-compile and use Mainline Kernel

Notes on how to set up a new Ubuntu LTS x64 environment, how to build a recent Mainline Kernel and place it on a Raspberry Pi OS SD card.

Procedure

  1. Install tools needed:
$ apt install git make gcc g++ device-tree-compiler bc bison flex libssl-dev libncurses-dev python3-ply python3-git libgmp3-dev libmpc-dev
@fnky
fnky / ANSI.md
Last active May 4, 2024 22:07
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

Nix Flake MVP

Goals

  • To provide Nix repositories with an easy and standard way to reference other Nix repositories.

  • To allow such references to be queried and updated automatically.

  • To provide a replacement for nix-channel, NIX_PATH and Hydra

@layus
layus / Readme.md
Last active February 3, 2018 00:14
Prefetch nix packages and update files in place

This bash script updates a package version and source hash directly in the source files.

It uses unsafeGetAttrPos to find the files to edit, which in turn require to get access to the real attrset. This is why we have to define the overlays.

@MadratJerry
MadratJerry / find-rls-preview.sh
Last active February 21, 2024 16:56
Find the latest rust nightly version with rls-preview
#!/bin/bash
MAC=false
date -r "$now" +%Y-%m-%d &> /dev/null
if [ "$?" -ne "0" ]; then echo "LINUX"; MAC=false; else echo 'MAC'; MAC=true; fi
now=`date +%s`
while true
do
if [ "$MAC" == "true" ]; then data=`date -r "$now" +%Y-%m-%d`; else data=`date -d @"$now" +%Y-%m-%d`; fi
@CMCDragonkai
CMCDragonkai / error_and_exception_handling_techniques.md
Last active January 8, 2024 16:45
Error and Exception Handling Techniques

Error and Exception Handling Techniques

http://lambda-the-ultimate.org/node/3896#comment-58374

Reposting here for safe keeping.

Error Codes

One of the return values is the error. Use when the goal is to cover-your-ass by ensuring that error handling is possible, even though you know any error handling or recovery would clutter the happy-path and thus ensure programmers are reluctant to admit to their existence at all.