Skip to content

Instantly share code, notes, and snippets.


Zachary Loeber zloeber

View GitHub Profile
nitrocode /
Last active Apr 29, 2020
Guesses terraform imports based on outputted plan
#!/usr/bin/env python3
# Currently works for 0.12.x
# - use json output instead of stdout
# Usage:
# terraform plan > plan.out
# python plan.out
import sys
pjobson /
Last active Jul 11, 2020
Syncthing Ubuntu/Mint Headless

Syncthing Ubuntu/Mint Headless


Syncthing is a free, open-source peer-to-peer file synchronization application available for Windows, Mac, Linux, Android, Solaris, Darwin, and BSD. It can sync files between devices on a local network, or between remote devices over the Internet. Data security and data safety are built into the design of the software.

This is written using Linux Mint 18.1 Serena x86_64 using kernel 4.4.0-139-generic.

I couldn't find good directions for doing this, so here we go.

eeddaann /
Last active Mar 2, 2021
query in PromQL to get docker swarm node names instead of node id


Prometheus is a time-series db, it's query language called PromQL.

Here are some analogies from SQL which may help to understand the basics of PromQL better:

  • metric ~ sql table
  • label ~ sql column


  • Count how many containers running on each node:
zentralwerkstatt /
Last active Nov 22, 2020
Install Syncthing on Linux
  • Install the necessary packages:
sudo apt-get install apt-transport-https ca-certificates
curl -s | sudo apt-key add -
echo "deb syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
sudo apt-get install git
  • Start syncthing once:
iambkramer / Export-Chocolatey.ps1
Last active Jul 17, 2020 — forked from alimbada/Export-Chocolatey.ps1
Export installed Chocolatey packages as chocolatey script
View Export-Chocolatey.ps1
choco list -lo -r -y | % { $_.Split('|') | select -First 1 } | % { "choco install " + $_ + " -y" }
choco list -lo -r -y | % { $_.Split('|') | select -First 1 } | % { "choco install " + $_ + " -y" } | Out-file choco-software.txt
ipbastola /
Last active May 5, 2021
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64


Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
mattifestation / drop_binary.bat
Created Jul 12, 2015
Drop binary data from the command line w/o needing PowerShell
View drop_binary.bat
echo -----BEGIN CERTIFICATE----- > encoded.txt
echo Just Base64 encode your binary data
echo TVoAAA== >> encoded.txt
echo -----END CERTIFICATE----- >> encoded.txt
certutil -decode encoded.txt decoded.bin
fearthecowboy / powershell_evil.cs
Last active Apr 14, 2020
Snooping the unbound powershell parameters during dynamic parameter generation
View powershell_evil.cs
/// ... somewhere in your cmdlet (might need to be PSCmdlet?)
private const BindingFlags BindingFlags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public;
// provided you have a tasty function to reflect private fields/properties
protected object TryGetProperty(object instance, string fieldName) {
// any access of a null object returns null.
if (instance == null || string.IsNullOrEmpty(fieldName)) {
return null;

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a