Skip to content

Instantly share code, notes, and snippets.

@mprahl
mprahl / main.go
Last active January 16, 2023 17:56
Simulate a scale test on the OCM Policy Propagator
package main
import (
"context"
"fmt"
"os/user"
"path"
"sync"
"k8s.io/apimachinery/pkg/api/errors"
@mprahl
mprahl / xps13-f26.sh
Last active June 1, 2018 13:44
Dell XPS 13 Work Laptop Setup Fedora 26
#!/bin/bash
dnf upgrade -y
# Set text scaling to 1.1 so the fonts are a bit larger
gsettings set org.gnome.desktop.interface text-scaling-factor 1.1
# Add the minimize and maximize buttons on windows
gsettings set org.gnome.desktop.wm.preferences button-layout 'appmenu:minimize,maximize,close'
# Turn on the battery percentage
gsettings set org.gnome.desktop.interface show-battery-percentage true
# Show Desktop Icons
gsettings set org.gnome.desktop.background show-desktop-icons true
@mprahl
mprahl / sid2str.py
Created October 30, 2016 01:53
Python 2.7/3.5 function to convert an Active Directory binary SID to string format (sid_to_str)
import sys
import struct
def sid_to_str(sid):
""" Converts a hexadecimal string returned from the LDAP query to a
string version of the SID in format of S-1-5-21-1270288957-3800934213-3019856503-500
This function was based from: http://www.gossamer-threads.com/lists/apache/bugs/386930
"""
# The revision level (typically 1)
@mprahl
mprahl / FizzBuzz.ps1
Last active August 29, 2015 14:24
This Is An Advanced FizzBuzz Function Using PowerShell
# This is a function that receives a numerical range and for multiples of three prints “Fizz” instead of the number and for
# the multiples of five prints “Buzz”. For numbers which are multiples of both three and five, the function prints “FizzBuzz”
function FizzBuzz {
# Allow the use of standard PowerShell cmdlet features, in this instance the function is using Write-Verbose
[CmdletBinding()]
Param (
# Specify that the $min variable is mandatory and must be an integer
[parameter(Mandatory=$true, ValueFromPipeline=$false)]
[int]$min,