Skip to content

Instantly share code, notes, and snippets.

View Ubeek's full-sized avatar

Levi Jarick Ubeek

  • Perth, Western Australia
View GitHub Profile
@albatrossflavour
albatrossflavour / auto_patch.pp
Created October 12, 2020 03:28
Example Puppet plan to patch nodes
plan profile::auto_patch_run (
String $patch_group,
Boolean $security_only = false,
Enum['always', 'never', 'patched', 'smart'] $reboot = 'patched',
){
# Query PuppetDB to find nodes that have the patch group,
# are not blocked and have patches to apply
$all_nodes = puppetdb_query("inventory[certname] { facts.pe_patch.patch_group = '${patch_group}'}")
$filtered_nodes = puppetdb_query("inventory[certname] { facts.pe_patch.patch_group = '${patch_group}' and facts.pe_patch.blocked = false and facts.pe_patch.package_update_count > 0}")
@jessfraz
jessfraz / boxstarter.ps1
Last active July 7, 2024 22:46
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@maxvt
maxvt / infra-secret-management-overview.md
Last active July 5, 2024 13:01
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@Iristyle
Iristyle / ruby-native-gems.md
Last active September 6, 2017 08:37
Installing gems that require Ruby DevKit on a machine that has installed Puppet from MSI
  • Install Puppet from MSI
  • Note that the Ruby install path is something like c:\program files\puppet labs\puppet\sys\ruby
  • Install Chocolatey in PowerShell with iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
  • Close / re-open PowerShell
  • Install Ruby Devkit - choco install ruby2.devkit
  • Add Ruby to the beginning of the PATH using an 8.3 style path - $Env:PATH = "C:\Progra~1\Puppet~1\Puppet\sys\ruby\bin;" + $Env:PATH (NOTE: dir /x inside cmd.exe can be helpful to find 8.3 style paths)
    • If done correctly gem env should contain a line with RUBY EXECUTABLE: C:/PROGRA~1/PUPPET~1/Puppet/sys/ruby/bin/ruby.exe
    • This part is absolutely critical, so if gem env doesn't have a bunch of 8.3 style paths, you've done something wrong
  • Configure DevKit for use with our vendored Ruby
  • cd \DevKit-2.0-x64
@rochacbruno
rochacbruno / ACCESS_ELASTIC.md
Last active May 3, 2024 19:15
Docker-compose wait-to-start

When unsing docker compose you can have a problem with the order of dependent linked containers

The solution is to start a script which tries to access a service and waits until it gets ready before loading your program

@mattlewissf
mattlewissf / add-p.md
Last active July 13, 2024 01:41
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@roundand
roundand / OpenWithSublimeText3.bat
Last active June 29, 2024 01:16 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@mwhite
mwhite / git-aliases.md
Last active July 14, 2024 14:47
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc