Skip to content

Instantly share code, notes, and snippets.

@PeteGoo
PeteGoo / entrypoint-from-ssm-env-vars.sh
Last active February 13, 2023 10:51
Helpful SSM Parameter Store scripts
#!/bin/bash
# To use just set a variable with SSM_<target_env_var>=<ssm_parameter_store_path>
# e.g. SSM_database_password=prod/myservice/database-password
function get_parameter {
SSM_ENV_VAR_NAME=$1
ENV_VAR_NAME=`echo "$SSM_ENV_VAR_NAME" | cut -c5-`
SSM_PARAM_NAME="${!SSM_ENV_VAR_NAME}"

Keybase proof

I hereby claim:

  • I am petegoo on github.
  • I am petegoo (https://keybase.io/petegoo) on keybase.
  • I have a public key whose fingerprint is BC12 C6A0 EB71 77CB 8720 186A A3EB 91C7 D76F F679

To claim this, I am signing this object:

==================================== Git Introduction and Internals

  1. Creating a repo

  2. Creating commits

  3. Exploring the .git object store

  • Commits (Anatomy of a commit)
@PeteGoo
PeteGoo / SSL.expiry.check.sh
Created April 10, 2016 19:29
SSL Expiration Check
echo | openssl s_client -connect sub.domain.com:443 2>/dev/null -servername sub.domain.com| openssl x509 -dates -noout -subject
@PeteGoo
PeteGoo / CollectorSourceManagementFunctions.ps1
Last active February 23, 2016 10:17
Copying Sumo Logic Collector Sources with Powershell
function Get-Collector([string] $collectorName, [PSCredential] $credential) {
$response = iwr "https://api.sumologic.com/api/v1/collectors" -Credential $credential
$content = ConvertFrom-Json $response.Content
$match = $content.collectors | Where {$_.name -eq $collectorName} | Select -First 1
return $match
}
function Get-CollectorSources([string] $collectorName, [PSCredential] $credential) {
$collector = Get-Collector $collectorName $credential
@PeteGoo
PeteGoo / Send-UdpDatagram.ps1
Last active December 29, 2023 00:07
Sending UDP datagrams in powershell
function Send-UdpDatagram
{
Param ([string] $EndPoint,
[int] $Port,
[string] $Message)
$IP = [System.Net.Dns]::GetHostAddresses($EndPoint)
$Address = [System.Net.IPAddress]::Parse($IP)
$EndPoints = New-Object System.Net.IPEndPoint($Address, $Port)
$Socket = New-Object System.Net.Sockets.UDPClient
@PeteGoo
PeteGoo / whatsmychar.py
Created January 21, 2015 04:24
Sublime Text ASCII character display
import sublime, sublime_plugin, textwrap, unicodedata
# from http://stackoverflow.com/questions/22063366/show-info-about-current-character-in-status-bar-in-sublime-text-2
class utfcodeCommand(sublime_plugin.EventListener):
def on_selection_modified(self, view):
# some test chars = $ €
sublime.status_message('Copying with pretty format')
selected = view.substr(view.sel()[0].a)
char = str(selected)
@PeteGoo
PeteGoo / Clone-SvnToGit.ps1
Last active August 29, 2015 14:05
git svn clone with AD user lookup and authors.txt output
<#
.SYNOPSIS
Clones an SVN repository usng git-svn, mapping users using Active Directory.
.DESCRIPTION
This function is a wrapper around git-svn that tries to resolve the names and email addresses of all users in the commit history
.Parameter SvnPath
The full path to the SVN repository
@PeteGoo
PeteGoo / futbol.csx
Created June 13, 2014 04:46
mmbot world cup
var robot = Require<Robot>();
robot.Respond(@"show all the scores", msg => {
msg.Http("http://live.mobileapp.fifa.com/api/wc/matches").GetJson((err, res, body) => {
var groups = GetMatches(msg).Where(m => m["b_Started"].Value<bool>()).GroupBy(m => m["c_Phase_en"].ToString());
if(!groups.Any()){
return;
@PeteGoo
PeteGoo / brain.explode.csx
Created April 18, 2014 04:17
Repro for mmbot #126
var robot = Require<Robot>();
var iterations = Enumerable.Range(0,100000);
var random = new Random();
Parallel.ForEach(iterations, i => {