Skip to content

Instantly share code, notes, and snippets.

View petersjt014's full-sized avatar
🙃

Josh Peters petersjt014

🙃
View GitHub Profile
@petersjt014
petersjt014 / sd-aarch64-nilfs.nix
Last active January 18, 2019 22:49
meant to build an aarch64 image with the much flash-friendlier nilfs2 filesystem for root
{ nixpkgs ? <nixpkgs>, system ? "aarch64-linux" } :
let
myisoconfig = { pkgs, config, ...}: {
imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix"
];
boot = {
kernelParams = [ "cma=32M" ];
@petersjt014
petersjt014 / sd-aarch64-f2fs.nix
Last active December 23, 2018 22:42
aarch64 image with f2fs as main filesystem
{ nixpkgs ? <nixpkgs>, system ? "aarch64-linux" } :
let
myisoconfig = { pkgs, config, ...}: {
imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix"
];
boot = {
kernelParams = [ "cma=32M" ];
@petersjt014
petersjt014 / closure-total-size-MiB.sh
Created December 23, 2018 21:20
finds the total size of a nix closure, taking into account both shared paths and my fear of variables
echo $@ | xargs -I _ bash -c "which _" | xargs -I _ nix-store -qR _ | sort | uniq | xargs -I _ du -sk _ | cut -f1 | paste -sd+ | xargs -I _ bash -c 'bc -l <<< "(_)/1024"'
@petersjt014
petersjt014 / IPFS avail script
Last active March 30, 2018 05:24
for finding availibility of ipfs dags
#!/bin/sh
# After taking in an IPFS multihash, this script calculates an 'availability' metric by:
# Traversing the hash's dag to find leaves,
# summing the number of providers per leaf (each rounded down to 10 for performance reasons), and
# returning providers/leaves*10.
# since `ipfs pin add` can be run non-recursively, a peer that advertises a given value
# may not actually posess the entire dag, which can be inconvenient.
#!/bin/sh
# this script is mostly just a pile of debug echos and such right now, as recursion within bash still mystifies me
# For testing, the following dag is very lightweight and shouldn't crash anything:
# QmRCJXG7HSmprrYwDrK1GctXHgbV7EYpVcJPQPwevoQuqF
# a diagram of the dag can be found here (or on your local gateway, of course):
# http://ipfs.io/ipfs/Qma8EX27uA27ASxseUuvnLPp8nUHtSDqJJZwCnU4D3uZHn
echo; echo "starting..."
@petersjt014
petersjt014 / IPFS monitor script
Created March 28, 2018 20:26
A simple bash script to monitor IPFS resource usage.
watch -n 4 -t "ipfs stats bw && echo && ipfs repo stat --human | head -n 3"
@petersjt014
petersjt014 / defaults
Last active January 18, 2018 23:16
pipe this bad boi into your bash to install some nice things
nix-env -iA nixos.fzf nixos.git nixos.htop nixos.hwinfo nixos.lynx nixos.nix-repl nixos.nnn nixos.p7zip nixos.testdisk nixos.tldr nixos.tmux nixos.tree nixos.w3m
@petersjt014
petersjt014 / configuration.nix
Last active November 27, 2017 17:05
wip nix config; has video driver issues + rendering artifacts
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@petersjt014
petersjt014 / micro.nix
Created November 13, 2017 00:25
file for micro
{ stdenv, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
name = "micro-${version}";
version = "1.3.3";
rev = "refs/tags/v${version}";
#buildInputs = [
# go-humanize
# json5

Keybase proof

I hereby claim:

  • I am petersjt014 on github.
  • I am petersjt014 (https://keybase.io/petersjt014) on keybase.
  • I have a public key ASB43zNlt3jUAZgmUQHi5NpOCUUPWfPOd6gKCCllnN4Ucgo

To claim this, I am signing this object: