Skip to content

Instantly share code, notes, and snippets.

View grahamc's full-sized avatar
❄️

Graham Christensen grahamc

❄️
View GitHub Profile
@grahamc
grahamc / emacs-init-as-a-package.nix
Created February 27, 2017 14:39
Package your user's emacs init.el etc. in to your nix emacs itself
{ pkgs ? import <nixpkgs> {} }:
let
emacsPackaging = pkgs.emacsPackagesNg;
my-mode = emacsPackaging.trivialBuild {
pname = "my-mode";
version = "1970-01-01";
src = pkgs.writeText "default.el" ''
(global-set-key (kbd "<end>") 'end-of-line)
(global-set-key (kbd "<home>") 'beginning-of-line)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Configures Energy Saver settings</string>
<key>PayloadDisplayName</key>
#!/bin/sh
set -eux
format() {
parted -s "$1" -- mklabel msdos
parted -s "$1" -- mkpart primary 1MiB 512MiB
parted -s "$1" -- set 1 boot on
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bind.dnsutils -p traceroute -p curl
# impure: needs ping
#source: https://s3.amazonaws.com/aws-cloudfront-testing/CustomerTesting.html
function _e {
echo "> $@"
eval "$@" 2>&1 | sed -e "s/^/ /"
printf "Exit: %s\n\n\n" "$?"
}
@grahamc
grahamc / catalina----- org.nixos.bootup.plist
Last active May 9, 2021 16:48
Dont delete this, I refer to it in some docs.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nixos.bootup</string>
<key>ProgramArguments</key>
<array>
<string>bash</string>
<string>/var/root/apply.sh</string>

Keybase proof

I hereby claim:

  • I am grahamc on github.
  • I am graham (https://keybase.io/graham) on keybase.
  • I have the public key with fingerprint BA94 FDF1 1DA4 0521 2864  C121 FE91 8C3A 98C1 030F

To claim this, I am signing this object:

@grahamc
grahamc / agency-codes.json
Last active August 7, 2019 11:35
Federal Reporting Agency Codes as a Service
{
"1200": "Department of Agriculture",
"1201": "Office of the Secretary of Agriculture",
"1203": "USDA, Office of the General Counsel",
"1204": "Office of the Inspector General",
"1205": "USDA, Office of the Chief Financial Officer",
"1208": "USDA, Office of Communications",
"1215": "USDA, Office of Operations",
"1260": "Commodity Credit Corporation",
"1261": "Rural Telephone Bank",
# Ordering Services
#
# Given a set of services, make them run one at a time in a specific
# order, on a timer.
let
lib = import <nixpkgs/lib>;
servicePrefix = "ordering-test-";
mkService = name: {
name = "${servicePrefix}${name}";
@grahamc
grahamc / shell.nix
Last active January 4, 2019 19:52 — forked from kalbasit/shell.nix
# This allows overriding nixpkgs by passing `--arg pkgs ...`
{ pkgs ? import ./devtools/lib/nix/nixpkgs.nix {}
, lib ? pkgs.lib
}:
with pkgs;
with lib;
let
grahamc@Morbo> docker run --user 1000:1000 -it --rm layered-on-top:latest ~/projects/nixpkgs
total 36
drwxr-xr-x 1 0 0 4096 Dec 4 17:39 .
drwxr-xr-x 1 0 0 4096 Dec 4 17:39 ..
-rwxr-xr-x 1 0 0 0 Dec 4 17:39 .dockerenv
dr-xr-xr-x 2 0 0 4096 Jan 1 1970 bin
drwxr-xr-x 5 0 0 360 Dec 4 17:39 dev
drwxr-xr-x 2 0 0 4096 Dec 4 17:39 etc
drwxrwxrwx 1 0 0 4096 Dec 4 17:39 example-output
dr-xr-xr-x 3 0 0 4096 Jan 1 1970 lib