Skip to content

Instantly share code, notes, and snippets.

View cransom's full-sized avatar

Casey Ransom cransom

View GitHub Profile
systemd.services.sopsProvision = {
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
serviceConfig.ExecStart = pkgs.writeShellScript "sopsProvision" config.system.activationScripts.setupSecrets.text;
};
[package]
name = "promimport"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
csv = "1.1"
serde = { version = "1", features = ["derive"] }
[=3h[=3h[=3h[=3hWelcome to GRUB!
Linux: 15285 512 byte blocks
Shim: 21272 512 byte blocks
Initrd: 1543470 512 byte blocks
 Booting `NixOS'
2022-10-07T19:41:08.411115Z  INFO pickup: <<pickup>>
at pickup/src/main.rs:61
/* $ time aws ec2 register-image --output text --region us-east-2 --name "coldsnap-test-staging-10" --architecture x86_64 --ena-support --sriov-net-support simple --virtualization-type hvm --block-device-mappings "[ { \"DeviceName\": \"/dev/sda1\", \"Ebs\": { \"SnapshotId\": \"$(coldsnap --region us-east-2 upload --wait /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img)\" } } ]" --query 'ImageId' --root-device-name /dev/sda1
ami-0cc753b15aaf9b198
real 0m31.255s
user 0m24.215s
sys 0m7.335s
$ du -chs /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img
2.5G /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img
2.5G total
/* $ time aws ec2 register-image --output text --region us-east-2 --name "coldsnap-test-staging-10" --architecture x86_64 --ena-support --sriov-net-support simple --virtualization-type hvm --block-device-mappings "[ { \"DeviceName\": \"/dev/sda1\", \"Ebs\": { \"SnapshotId\": \"$(coldsnap --region us-east-2 upload --wait /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img)\" } } ]" --query 'ImageId' --root-device-name /dev/sda1
ami-0cc753b15aaf9b198
real 0m31.255s
user 0m24.215s
sys 0m7.335s
$ du -chs /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img
2.5G /nix/store/nngyyq6j149fj98nq8ds8v10c31ksqdx-routing-disk-image/nixos.img
2.5G total
#!/usr/bin/perl -w
# $Id: krainthx,v 1.7 2003/04/14 20:00:33 spy Exp $
# ben
#initialize color map and set counters
@colormap = (4,4, 7,7, 5,5, 8,8, 9,9, 3,3, 10,10, 11,11, 12,12, 2,2, 6,6, 13,13);
my $row = 0;
my $rainstate = 0;
my $badstate = 0;
# setup tmp filE
@cransom
cransom / garage.md
Created September 27, 2019 21:21
If i were to IOT a garage door now...

My implementation 4 (or more?) years ago was:

  • wemos d1 mini module
  • hc-sr04 ultrasonic distance sensor
  • photo resistor (measure light level from the automatic light or ambient if open)
  • wemos 1ch relay. could have used a transistor, but i am iffy on what kind of voltage the garage button is using. electrical isolation is nice. my button does have couple modes like turning a light on as well if you let some amount of voltage through, but i didn't go there
  • hacked up arduino code using mqtt and some very fiddly json parsing that's frafile if you glance at it weird. the software didn't exist when i hacked mine how i wanted it.
  • homeassistant doing all the home automation things. It hooked into Homeassistant via MQTT sending messages back and forth. The distance sensor could only really tell if you the door is nearly all the way open due to how it was mounted. Knowing closed would be nicer but i would have had to mount it farther away and it's been fine so far.

I 3d printed a case/mount for it to dangle a

#eno1.10 is outside, eno1.20 is inside.
services.dnsmasq = {
enable = true;
resolveLocalQueries = true;
extraConfig = ''
dhcp-range=::1,::ffff,constructor:eno1.20,ra-names,48h
#and other stuff
'';
};
#!/usr/local/bin/bash
if [ -n "$1" ]; then
file=$1
else
file="source"
fi
fetchargs=""
linenumber=0
@cransom
cransom / irda
Created February 25, 2019 18:37
#!/bin/sh
killall ircomm >/dev/null
ircomm -d /dev/cuaa1 -y /dev/ptypv -v2