Skip to content

Instantly share code, notes, and snippets.

@elliot-u410
elliot-u410 / bundle-macos.nix
Last active September 6, 2023 14:22
bundle-nix-macos.sh
{ pkgs }:
pkg:
pkgs.runCommand "bundle-${pkg.name}" {
nativeBuildInputs = with pkgs; [ coreutils which darwin.binutils darwin.sigtool ];
} ''
find '${pkg}/bin' -type f -executable -exec '${./bundle-macos.sh}' '{}' "$out" \;
''
@elliot-u410
elliot-u410 / alertcmd.sh
Last active October 15, 2021 20:46
alertcmd.sh
#!/usr/bin/env bash
set -uo pipefail
: "${ALERT_CMD_THRESHOLD_SECONDS:=5}"
: "${ALERT_CMD_SUCCESS_SOUND:=glass}"
: "${ALERT_CMD_FAIL_SOUND:=sosumi}"
if ! which terminal-notifier > /dev/null; then
>&2 echo "Install terminal-notifier!"
@elliot-u410
elliot-u410 / mapfunc.py
Created September 23, 2021 20:56
mapfunc Ansible Filter Plugin
#!/usr/bin/env python
class FilterModule(object):
def filters(self):
return {
'mapfunc': self.mapfunc,
'applyfunc': self.applyfunc,
}
def mapfunc(self, items, func_expr_str, *static_args, **static_kwargs):
"""Map a Python function over all the inputs.
@elliot-u410
elliot-u410 / lotus.nix
Last active September 11, 2021 04:29
lotus.nix
let
nixpkgs = builtins.fetchTarball {
url = "https://releases.nixos.org/nixpkgs/nixpkgs-21.11pre313691.ccb19cf7d00/nixexprs.tar.xz";
sha256 = "sha256:10qkfx7p9jy8az1lcbn731nbzwi38228xkxbza0lbmmlwhm8i8jw";
};
in
{ nixpkgsFunc ? import nixpkgs
, enableRustNativeCpu ? true
}:
with (nixpkgsFunc {