Skip to content

Instantly share code, notes, and snippets.

@vancluever
vancluever / macos-verify.sh
Created Apr 2, 2021
Validate MacOS Binary's Signature/Notarization Status
View macos-verify.sh
#!/usr/bin/env sh
spctl -a -vv "$1" && codesign --test-requirement="=notarized" --verify --verbose "$1" && codesign -dv --verbose=4 "$1"
@vancluever
vancluever / macos-big-sur-ssh-agent-local-no-disable-sip.md
Last active Mar 30, 2021
Run SSH Agent w/Modified Options (MacOS Big Sur, No Homebrew, No SIP Modification)
View macos-big-sur-ssh-agent-local-no-disable-sip.md

Run SSH Agent w/Modified Options (MacOS Big Sur, No Homebrew, No SIP Modification)

The following will show you how you can modify the startup options of the SSH agent supplied by MacOS in a non-invasive way. This can be useful for doing things like setting a key lifetime, which can then be used with AddKeysToAgent in your ~/.ssh/config to automate the timing out of saved keys. This ensures that your passphrase is re-asked for periodically without having to shutdown, re-log, or having it actually persisted in keychain, the latter being almost as bad as having no passphrase at all, given that simply being logged in is generally enough to then use the key.

This method does not modify the system-installed SSH agent service (com.openssh.ssh-agent), but rather duplicates its functionality into a user-installed launch agent where we can then modify the options. Modifying the system-installed service is becoming increasingly harder to do; SIP generally protects

@vancluever
vancluever / tfr-downloads-rank.sh
Created Mar 12, 2021
Get Terraform Registry community modules, sort by most downloads
View tfr-downloads-rank.sh
#!/usr/bin/env bash
getproviders() {
for (( PAGE=1; ; PAGE++ )); do
DATA="$(curl -fs "https://registry.terraform.io/v2/providers?filter[tier]=community&page[number]=$PAGE")"
if [ "$(jq '.data' <<< "$DATA")" == "[]" ]; then
break
fi
jq '.data[] | {name: .attributes["full-name"], downloads: .attributes.downloads}' <<< "$DATA"
done
@vancluever
vancluever / mixed_indent_hcl.go
Created Apr 26, 2018
HCL + Go mixed indentation example (vim-airline)
View mixed_indent_hcl.go
package main
import "fmt"
const fooBar = `
resource "foo" "bar" {
a = "b"
}
`
@vancluever
vancluever / genselfsignedcrt.sh
Created Feb 7, 2018
OpenSSL self-signed cert one-liner
View genselfsignedcrt.sh
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -keyout server.key -out server.crt
@vancluever
vancluever / asciinema.bashrc
Created Jan 4, 2018
Add a recording signal to your bash prompt if you are using asciinema
View asciinema.bashrc
if [ -n "${ASCIINEMA_REC}" ]; then
PS1='[\[\e[31m\]•REC\[\e[0m\] \W]\$ '
else
PS1='[\u@\h \W]\$ '
fi
@vancluever
vancluever / ssh-agent.service
Created Jan 4, 2018
SSH agent systemd service
View ssh-agent.service
[Unit]
Description=OpenSSH Agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK="%t/ssh-agent.socket"
ExecStart=/usr/bin/ssh-agent -D -t 14400 -a "${SSH_AUTH_SOCK}"
[Install]
WantedBy=default.target
@vancluever
vancluever / vecty_hello.go
Created Jun 7, 2017
A small-ish example on how to use vecty
View vecty_hello.go
package plan
import (
"log"
"github.com/davecgh/go-spew/spew"
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.com/gopherjs/vecty/event"
"github.com/gopherjs/vecty/prop"
@vancluever
vancluever / resource_aws_security_group_attachment.go
Created Jun 6, 2017
Start of a security group attachment resource (attach a SG to a single instance or ENI)
View resource_aws_security_group_attachment.go
package aws
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsSecurityGroupAttachment() *schema.Resource {
return &schema.Resource{
View nomaddiff.log
2017/06/02 19:18:33 [INFO] Terraform version: 0.9.6 dev f84310e15c4f307fda900cc543894591bf98ea16+CHANGES
2017/06/02 19:18:33 [INFO] Go runtime version: go1.8.3
2017/06/02 19:18:33 [INFO] CLI args: []string{"/home/chrism/Documents/code/GOPATH/bin/terraform", "plan", "-out", "terraform.tfplan"}
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] Attempting to open CLI config file: /home/chrism/.terraformrc
2017/06/02 19:18:33 [INFO] CLI command args: []string{"plan", "-out", "terraform.tfplan"}
2017/06/02 19:18:33 [DEBUG] Detected home directory from env var: /home/chrism
2017/06/02 19:18:33 [DEBUG] command: loading backend config file: /home/chrism/src/tf_examples/nomad_job_custom_diff_test
2017/06/02 19:18:33 [DEBUG] command: no data state file found for backend config