Skip to content

Instantly share code, notes, and snippets.

View zloeber's full-sized avatar

Zachary Loeber zloeber

View GitHub Profile
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

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

@fearthecowboy
fearthecowboy / powershell_evil.cs
Last active August 25, 2022 11:02
Snooping the unbound powershell parameters during dynamic parameter generation
/// ... 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;
}
@mattifestation
mattifestation / drop_binary.bat
Created July 12, 2015 05:49
Drop binary data from the command line w/o needing PowerShell
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
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active April 3, 2024 06:54
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

Reference

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

1. Check the current kernel version

$ uname -r 
@iambkramer
iambkramer / Export-Chocolatey.ps1
Last active July 17, 2020 19:54 — forked from alimbada/Export-Chocolatey.ps1
Export installed Chocolatey packages as chocolatey script
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
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active February 20, 2023 23:55
Install Syncthing on Linux
  • Install the necessary packages:
sudo apt-get install apt-transport-https ca-certificates
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ 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:
@jpswade
jpswade / devops_best_practices.md
Last active April 16, 2024 18:35
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing

@eeddaann
eeddaann / PromQL-docker-swarm-node-name.md
Last active March 2, 2021 14:11
query in PromQL to get docker swarm node names instead of node id

PromQL

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

example:

  • Count how many containers running on each node:
@elasticdog
elasticdog / vault-cp
Created July 27, 2018 18:32
A script to copy Vault secrets from one path to another
#!/usr/bin/env bash
# ensure we were given two command line arguments
if [[ $# -ne 2 ]]; then
echo 'usage: vault-cp SOURCE DEST' >&2
exit 1
fi
source=$1
dest=$2