Skip to content

Instantly share code, notes, and snippets.

View qbit's full-sized avatar
🐡
blub blub

Aaron Bieber qbit

🐡
blub blub
View GitHub Profile

aspe:keyoxide.org:GSNZLKLG7KZRQM2DLUQPWU6HR4

@qbit
qbit / server.go
Created December 5, 2022 21:24
AI generated web server that is restricted to /tmp on OpenBSD and Linux
package main
import (
"log"
"net/http"
"os"
"golang.org/x/sys/unix"
)
{
description = "bold.daemon";
inputs = {
unstable = { url = "github:NixOS/nixpkgs/nixos-unstable"; };
stable = { url = "github:NixOS/nixpkgs/nixos-21.11"; };
sops-nix.url = "github:Mic92/sops-nix";
sshKnownHosts = {
@qbit
qbit / ssh-fido-agent.nix
Last active May 12, 2022 18:58
Derivation that fires off $SSH_ASKPASS when a yubikey is attached. When askpass finishes, the yk is added to ssh-agent
{ config, lib, pkgs, ... }:
let
fidoAddDevice = pkgs.writeScriptBin "fido-add-device" ''
#! ${pkgs.runtimeShell} -e
DISPLAY="$(systemctl --user show-environment | ${pkgs.gawk}/bin/awk -F= '/^DISPLAY/ {print $NF}')"
SSH_AUTH_SOCK="$(echo $XDG_RUNTIME_DIR/ssh-agent)";
export DISPLAY SSH_AUTH_SOCK
function agent_add() {
{
description = "bold.daemon";
# TODO: figure out how to make things pure (./pkgs...)
inputs = {
unstable = { url = "github:NixOS/nixpkgs/nixos-unstable"; };
stable = { url = "github:NixOS/nixpkgs/nixos-21.11"; };
};

Things I dislike about Rust

  • Things I strongly dislike:
    • The dividing line between crate and stdlib leans way too far to the crate side of things.
      • Remote dependencies are needed to do virtually everything. There isn’t even a rand package in the standard library.
    • Implicit returns.
      • Semicolon on return changes behavior:

fn add1(a: i32, b: i32) -> i32 {

@qbit
qbit / shell.nix
Created February 24, 2022 02:17
Nix shell for building Renode
# Things build fine, tests are nto able to run (pip doesn't have robotframework 4.0.1?
# Renode executes, but for some reason the UI fails to start.
{ pkgs ? import <nixpkgs> { } }:
let
mybot = pkgs.python3Packages.buildPythonPackage rec {
pname = "robotframework";
version = "4.0.1";
src = pkgs.python3Packages.fetchPypi {
@qbit
qbit / cloudSettings
Last active July 30, 2021 13:43
VSCode Config
{"lastUpload":"2021-07-30T13:43:42.920Z","extensionVersion":"v3.4.3"}
{ config, lib, options, pkgs, fetchFromGitHub, kernel, kmod, ... }:
let
pubKeys = [
"[email protected] AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIDEKElNAm/BhLnk4Tlo00eHN5bO131daqt2DIeikw0b2AAAABHNzaDo= [email protected]"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBZExBj4QByLZSyKJ5+fPQnqDNrbsFz1IQWbFqCDcq9g [email protected]"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIITjFpmWZVWixv2i9902R+g5B8umVhaqmjYEKs2nF3Lu [email protected]"
];
vmmClock = config.boot.kernelPackages.callPackage ./vmm_clock.nix { };
virtioVmmci = config.boot.kernelPackages.callPackage ./virtio_vmmci.nix { };
@qbit
qbit / 9.js
Last active March 20, 2020 22:54
9term-ish theme for Blink shell
t.prefs_.set('color-palette-overrides',["#212121", "#c30771", "#10a778", "#a89c14", "#008ec4", "#523c79", "#20a5ba", "#d9d9d9", "#424242", "#fb007a", "#5fd7af", "#f3e430", "#20bbfc", "#6855de", "#4fb8cc", "#f1f1f1"]);
t.prefs_.set('foreground-color', "#000000");
t.prefs_.set('background-color', "#ffffea");
t.prefs_.set('cursor-color', 'rgba(32,187,252,0.5)');