Skip to content

Instantly share code, notes, and snippets.

@stuart-warren
stuart-warren / TDD-README
Last active October 18, 2024 10:59
Monitor files for changes and run test command (TDD)
$ brew install fswatch
$ alias pywatch='fswatch -r -0 --monitor=poll_monitor $(find . -name *.py) | xargs --null -n1 -I{}'
$ alias gowatch='fswatch -r -0 --monitor=poll_monitor $(find . -name *.go) | xargs --null -n1 -I{}'
$ pywatch python setup.py test
$ gowatch go test -cover
@stuart-warren
stuart-warren / simple-gpg-enc.go
Last active August 30, 2024 05:58
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@stuart-warren
stuart-warren / sway.config.diff
Created February 22, 2023 21:33
Diff of sway config changes from default /etc/sway/config
10a11
> set $hyper Mod4+Mod1+Ctrl+Shift
61a63,66
> input "type:keyboard" {
> xkb_layout us
> xkb_variant dvorak
> }
74c79
< bindsym $mod+d exec $menu
---
@stuart-warren
stuart-warren / Vagrantfile
Created August 18, 2015 07:38
Ubuntu cloud with user-data cloud config in Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
@stuart-warren
stuart-warren / README.md
Last active April 8, 2024 22:00
Nix on Ubuntu

Setup on Fresh Ubuntu install

sudo apt install curl git
curl -L https://nixos.org/nix/install | sh -s -- --daemon
# follow prompts
git clone <this-repo> ~/nix
# edit files, replace my username with yours
cd ~
mkdir -p ~/.local/state/nix/profiles
@stuart-warren
stuart-warren / CreateJob.sh
Last active March 8, 2024 16:20
Create a job in Jenkins (or folder) using the HTTP API
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
@stuart-warren
stuart-warren / README.md
Last active December 29, 2023 12:46
Build NixOS iso for intel macbook
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix --verbose
@stuart-warren
stuart-warren / docker-compose.yml
Last active November 24, 2023 09:35
Start chrome with docker-compose (helps with aws greengrass iot core also)
version: "3.8"
services:
chrome:
network_mode: "host"
image: jess/chrome
environment:
DISPLAY: 'unix:0'
volumes:
- /run/dbus/system_bus_socket:/run/dbus/system_bus_socket
@stuart-warren
stuart-warren / passage-macos-README.md
Last active August 3, 2023 11:55
password-store encrypted using macbook fingerprint sensor
@stuart-warren
stuart-warren / Exception.rb
Last active October 28, 2022 13:37
Windows Event log via nxlog (json) -> logstash 1.2 config
Exception in filterworker {"exception"=>#<NoMethodError: undefined method `[]=' for nil:NilClass>, "backtrace"=>["file:/opt/logstash/logstash.jar!/logstash/event.rb:135:in `[]='", "org/jruby/RubyProc.java:255:in `call'", "(eval):9:in `exec'", "org/jruby/RubyProc.java:255:in `call'", "file:/opt/logstash/logstash.jar!/logstash/util/fieldreference.rb:44:in `exec'", "file:/opt/logstash/logstash.jar!/logstash/event.rb:134:in `[]='", "file:/opt/logstash/logstash.jar!/logstash/filters/mutate.rb:234:in `rename'", "org/jruby/RubyHash.java:1332:in `each'", "file:/opt/logstash/logstash.jar!/logstash/filters/mutate.rb:232:in `rename'", "file:/opt/logstash/logstash.jar!/logstash/filters/mutate.rb:205:in `filter'", "(eval):127:in `initialize'", "org/jruby/RubyProc.java:255:in `call'", "file:/opt/logstash/logstash.jar!/logstash/pipeline.rb:243:in `filter'", "file:/opt/logstash/logstash.jar!/logstash/pipeline.rb:191:in `filterworker'", "file:/opt/logstash/logstash.jar!/logstash/pipeline.rb:134:in `start_filters'"], :level=>: