Skip to content

Instantly share code, notes, and snippets.

View blueforesticarus's full-sized avatar
🏴‍☠️
hoes mad I killin it like always

segfault blueforesticarus

🏴‍☠️
hoes mad I killin it like always
View GitHub Profile
@blueforesticarus
blueforesticarus / browser.nu
Created March 1, 2024 02:54
nushell script to parse (and interactively select using skim) brave browser history and bookmarks
#!/usr/bin/env nu
let BRAVE = ( glob ~/.config/BraveSoftware/Brave-Browser/Default/).0
def _history [] {
# make a copy of the history db, because it is locked when brave is open
let p = (mktemp -t)
cp $"($BRAVE)/History" $p
open $p
@blueforesticarus
blueforesticarus / grid-test.html
Created December 8, 2023 02:43
css grid layout with row divs
<div>
<!--
This part could be better with CSS3 attr() if any browser actually supported it.
then we could use attributes instead of inline style, which would make selecting an element easier.
-->>
<div style="grid-row: 1">
<div style="grid-column: 1">A</div>
<div style="grid-column: 2">B</div>
</div>
<div style="grid-row: 2">
@blueforesticarus
blueforesticarus / http.nix
Created March 30, 2023 07:25
A nix config for apache, with all php files being sent to php-fpm. Also Perl. Also simple user/pass protection.
{ config, pkgs, lib, ... }:
let
test_domain = "test.example.com";
perlEnv = pkgs.perl.withPackages (p: with p; [
CGI
]);
in
{
@blueforesticarus
blueforesticarus / agnosticmap.rs
Last active November 18, 2022 19:10
segfault's monster
/*
Sick of the type system catching your mistakes?
Wish you could just yeet anything into a hashmap with arbitrary key and value types like in python?
Wish that unlike python, you could have the same key map to differnt entries for each type of data?
Well, this is for you.
motivation: I need runtime configured models (blackbox computation) which can depend on each other.
idea: Create a cache of all the state the program knows about. Models access state by key and type.
*/
{ config, lib, pkgs, ... }:
{
systemd = {
services.nixos-update-prebuild = {
serviceConfig.Type = "oneshot";
environment.PATH = lib.mkForce "/run/current-system/sw/bin";
script = ''
source /etc/profile
mkdir -p /var/lib/nixos-update-prebuild
cd /var/lib/nixos-update-prebuild
https://hypercore-protocol.org/protocol/#hypercore
https://yggdrasil-network.github.io/
https://github.com/cjdelisle/cjdns
https://github.com/ipfs/ipfs
https://urbit.org/
@blueforesticarus
blueforesticarus / tardiff
Last active March 2, 2021 17:54
shell script to produce a tar representing the difference between two directories or one directory and a base tar. (can be used as a filesystem patch)
#!/bin/bash
BASE=$2
OUT=diff.tar
if test -z "$TMP"; then
TMP=`mktemp -d -t tardiff-XXXXXXXX`
else
TMP=`realpath $TMP`
fi
@blueforesticarus
blueforesticarus / test_shared.sh
Created August 26, 2020 22:15
determine upper bound increase in size if every exe on the system was statically linked.
#this will figure out how much additional space would be taken up if all executables were static.
( cat asdf || ( \
sudo fd . '/' --type x -E *.sh -E *.py -E *.so -E *.so.* -E *.la -E *.js \
| xargs -I {} ldd {} 2>/dev/null \
| tee asdf \
)) \
| grep -v "no version information" \
| grep -v "/home/" \
| sort \
| sed 's/(.*)//g' \
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@blueforesticarus
blueforesticarus / intersection.html
Last active October 23, 2015 20:16
Creates two three.js geometries and highlights all the intersections between them.
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - geometry - cube</title>
<meta charset="utf-8">
<style>
body {
margin: 0px;
background-color: #000000;