Skip to content

Instantly share code, notes, and snippets.

@acobaugh
acobaugh / git-crypt-list-keys.sh
Created September 29, 2017 15:23
List git-crypt gpg keys
for key in .git-crypt/keys/default/0/* ; do gpg -k $(echo $(basename $key) | sed -e 's/.gpg//') ; done ;
@acobaugh
acobaugh / gist:656d671c13adfa83a3492ceb0bfe188f
Last active August 17, 2019 05:07
Terraform get only symlinks first missing instance of local module
% TF_LOG=trace tf get
2019/08/17 01:01:33 [INFO] Terraform version: 0.12.6
2019/08/17 01:01:33 [INFO] Go runtime version: go1.12.7
2019/08/17 01:01:33 [INFO] CLI args: []string{"/usr/bin/terraform", "get"}
2019/08/17 01:01:33 [DEBUG] Attempting to open CLI config file: /home/acobaugh/.terraformrc
2019/08/17 01:01:33 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/08/17 01:01:33 [INFO] CLI command args: []string{"get"}
2019/08/17 01:01:33 [TRACE] ModuleInstaller: installing child modules for . into .terraform/modules
2019/08/17 01:01:33 [DEBUG] Module installer: begin acm
2019/08/17 01:01:33 [TRACE] ModuleInstaller: Module installer: acm 2.2.0 already installed in .terraform/modules/acm/terraform-aws-modules-terraform-aws-acm-1318df0
@acobaugh
acobaugh / rebuild_fstab.sh
Created April 24, 2019 15:47
A silly little script to potentially rebuild an fstab file based on the contents of mtab.
#!/usr/bin/env bash
while read line ; do
if [ "$(echo $line | egrep '^\/dev\/sd')" != "" ] ; then
dev="$(echo $line | awk '{ print $1 }')"
id="$(blkid $dev | awk '{ print $2 }')"
echo $line | sed -e "s|$dev|$id|"
else
echo $line
fi
xbps-install -S
xbps-install void-repo-nonfree
xbps-install -S
xbps-install \
alacritty artwiz-fonts base-system bc chromium cryptsetup dmenu docker feh firefox fluxbox git git-crypt gkrellm google-fonts-ttf grub-i-efi grub-x-efi lvm lxdm lxdm-theme-vdojo mdadm network-manager-applet notify-osd notify-send.sh ntp-p ohsnap-font pass pavucontrol pm-utils redshift screen setxkbmap slock terraform tlp upower vim xautolock xf-input-synaptics xf-video-fbdev xf-video-intel xfontsel xmodmap xorg-fonts xorg-input-drivers xrdb xterm zsh clearlooks-phenix-darkpurpy-theme pulseaudio
@acobaugh
acobaugh / gist:5aecffbaaa593d80022b3534e5363a2d
Created August 11, 2017 02:32
MIT Kerberos Logstash filter
# Kerberos krb5kdc/kadmind/kpropd
if [program] == "kadmind" {
grok {
match => { "syslog_msg" => "^Request: %{DATA:kadmind_request}, client=%{DATA:kadmind_client}, service=%{DATA:kadmind_service}, addr=%{IP:kadmind_addr}$" }
match => { "syslog_msg" => "^%{DATA:kadmind_other}$" }
add_tag => [ "kadmind" ]
}
}
if [program] == "krb5kdc" {
grok {
# node that is broken after adding fabric network:
2017-10-30T21:53:34.237047+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx0: Copper link is up (1000Mbps, Full Duplex)
2017-10-30T21:53:34.237052+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx0: Copper link is down
2017-10-30T21:53:34.237057+00:00 cn1 mac: [ID 435574 kern.info] NOTICE: bnx0 link up, 0 Mbps, half duplex
2017-10-30T21:53:34.237062+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx0: Copper link is up (100Mbps, Full Duplex)
2017-10-30T21:53:34.237067+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx0: Copper link is down
2017-10-30T21:53:34.237072+00:00 cn1 mac: [ID 435574 kern.info] NOTICE: bnx0 link up, 0 Mbps, half duplex
2017-10-30T21:53:34.237182+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx2: Copper link is down
2017-10-30T21:53:34.237187+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx4: Copper link is down
2017-10-30T21:53:34.237191+00:00 cn1 bnx: [ID 328528 kern.info] NOTICE: bnx3: Copper link is down
### Keybase proof
I hereby claim:
* I am acobaugh on github.
* I am andrewcobaugh (https://keybase.io/andrewcobaugh) on keybase.
* I have a public key ASArXu67f6ZPI0utHwJHdwN_Hlw0X9PBIj4AMpLuUDjg9Ao
To claim this, I am signing this object:
@acobaugh
acobaugh / gist:6988dbcdf179d5e8e86b9674c28f4c13
Created June 15, 2017 14:54
NSS_SDB_USE_CACHE=yes demonstration
$ strace -fc -e trace=access curl 'https://www.google.com' > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11576 0 11576 0 0 36381 0 --:--:-- --:--:-- --:--:-- 161k
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000133 0 1506 1503 access
------ ----------- ----------- --------- --------- ----------------
100.00 0.000133 1506 1503 total
vars:
any::
"el6_64_install_packages" slist => {
"cosign-psu-cgi",
"cosign-psu-factor-duo",
"jansson",
"perl-RPC-XML",
"perl-Crypt-SSLeay"
};
body common control {
bundlesequence => { "main" };
}
bundle agent main {
vars:
"notempty" string => "foo";
"notempty2" string => "bar";
"data_string" string => string_mustache("not empty = {{vars.main.notempty}} ; empty = {{^vars.main.empty}}default{{/vars.main.empty}} ; not empty with default = {{^vars.main.notempty2}}default{{/vars.main.notempty2}}");
reports: