Skip to content

Instantly share code, notes, and snippets.

@josheinstein
josheinstein / PSObjectComparer.cs
Created May 1, 2012 21:17
IComparer for PSObjects in PowerShell
namespace Einstein.PowerShell
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
@IISResetMe
IISResetMe / Test-NullPerformance.ps1
Last active August 29, 2019 15:57
Output suppression and the pipeline
<#
.Synopsis
Performance test for output suppression in PowerShell
.DESCRIPTION
Very basic performance test against different types of output suppression in PowerShell
Increase the value of the Iterations parameter to observe how performance impacts the different methods
@monostere0
monostere0 / format.json.bookmarklet.js
Last active December 8, 2022 04:44
Format JSON bookmarklet
javascript:!function(){var n,e,r,i;n=window,e=document.body,r=JSON.parse,i=JSON.stringify,n.isf||(e.innerHTML="<pre>"+i(r(e.innerText),null,4).replace(/\"(.*)[^\:]\:/g,'<span style="color:#9C3636">$1&colon;</span>')+"</pre>",n.isf=!0)}();
//usage:
//save as bookmark and click it whenever you open a json response in a browser tab/window
@AdamOssenford
AdamOssenford / ansible-summary.md
Created January 18, 2016 00:50
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

Function Get-ImageText()
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=0,ValueFromPipeline=$True)]
[String] $Path
)
Process{
$SplatInput = @{
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active June 17, 2024 15:05
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@debnath
debnath / paperclips-savegame
Last active June 5, 2024 15:30
How to save and load the state of the paperclips game (www.decisionproblem.com/paperclips/index2.html)
The paperclips game over at www.decisionproblem.com/paperclips/index2.html is great, but if you want to play the game indefinitely you can lose all progress if you clear browser cache or change laptop.
I wanted a way to create a save file and load it later, so I did. Use the below script to generate the output to load the current game state.
var saveGame=localStorage.getItem("saveGame"),savePrestige=localStorage.getItem("savePrestige"),saveProjectsActive=localStorage.getItem("saveProjectsActive"),saveProjectsFlags=localStorage.getItem("saveProjectsFlags"),saveProjectsUses=localStorage.getItem("saveProjectsUses"),saveStratsActive=localStorage.getItem("saveStratsActive"),restoreString="/************* COPY ALL TEXT BELOW THIS LINE AND SAVE IN A TEXTFILE SOMEWHERE. RUN IT IN ANY CHROME OR FIREFOX CONSOLE TO LOAD IT. *************/\nlocalStorage.setItem('saveGame', '"+saveGame+"') \nlocalStorage.setItem('savePrestige', '"+savePrestige+"') \nlocalStorage.setItem('saveProjectsActive', '"+saveProjectsActive+"')
@jborean93
jborean93 / Ansible Example.ps1
Last active November 15, 2023 19:36
WSMan Raw
$bootstrap_wrapper = {
&chcp.com 65001 > $null
$exec_wrapper_str = $input | Out-String
$split_parts = $exec_wrapper_str.Split(@("`0`0`0`0"), 2, [StringSplitOptions]::RemoveEmptyEntries)
If (-not $split_parts.Length -eq 2) { throw "invalid payload" }
Set-Variable -Name json_raw -Value $split_parts[1]
$exec_wrapper = [ScriptBlock]::Create($split_parts[0])
&$exec_wrapper
}.ToString()
@agaffney
agaffney / gist:679ece1117f6e49cffe086846ec9bb2c
Last active December 14, 2022 12:56
Building/installing AWX for ARM64

NOTE: it seems that somebody else beat me to this, so I'm not going to finish this

https://qiita.com/ussvgr/items/81b88653b2845b0f1bea

Prerequisites:

  1. An ARM64 machine with Ansible and Docker installed to build the images on. This doesn't necessarily need to be the same machine that you're going to deploy AWX on. Considering using something like an AWS Graviton2-based EC2 instance to cut down on image build time
  2. A Docker registry to push the custom images to
  3. A Kubernetes cluster on ARM64 to deploy on