Skip to content

Instantly share code, notes, and snippets.

View KatelynHaworth's full-sized avatar

Katelyn Haworth KatelynHaworth

View GitHub Profile
@KatelynHaworth
KatelynHaworth / CrateObject.scala
Last active August 29, 2015 14:24
A simple yet powerful helper class to provide the most simplistic way to create & drop tables and insert & select data based on scala case classes in Crate DB (https://crate.io) | Requires the Crate Java Client (https://bintray.com/crate/crate/crate-client/view)
import java.io.IOException
import io.crate.client.CrateClient
/**
* CrateObject supplies methods
* for objects to store them in
* a Crate Database
*
* @author Liam Haworth
* @version 1.0
@KatelynHaworth
KatelynHaworth / findBlob.sh
Created May 5, 2016 05:41
Simple little bash function to search file for a section of text when you only now the start and end of the sections (Used to search postgresql database dumps)
#// Searchs a file for a blob (section)
#// and returns what it finds in a array
#//
#// PARAMS:
#// $1 String - The name of the file to search
#// $2 String - The upper bound (start) of the blob
#// $3 String - The lower bound (end) of the blob
#// $4 Boolean - Defines if the contense of the bounds should be included in the results
findBlobInFile() {
mapfile -t lines < <(cat $1)
@KatelynHaworth
KatelynHaworth / getModelFromServiceTag
Created May 25, 2016 05:40
A simple little tool for the CLI to lookup the model for a Dell system based on its service tag
#!/bin/bash
#
# A simple command line tool to
# look the system model for a Dell
# service tag
#
# Usage:
# getModelFromServiceTag SERVICE_TAG
#
# Author: Liam Haworth <[email protected]>
@KatelynHaworth
KatelynHaworth / whoOwnsThisIP.sh
Last active September 9, 2016 05:16
A simple bash tool to lookup the own of an IP address. TL;DR a straight to the point whois
#!/bin/bash
#
# A simple bash script to look up
# who owns an IP Address based on
# the IP address's whois data
#
# Author: Liam Haworth <[email protected]>
#
IPADDR=$1
@KatelynHaworth
KatelynHaworth / notifyAddrChange.go
Created June 22, 2017 05:03
A simple go program leveraging the Window API to listen for IPv4 network address change events
package main
import (
"log"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
@KatelynHaworth
KatelynHaworth / main.go
Last active August 9, 2024 02:08
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@KatelynHaworth
KatelynHaworth / callback.go
Created March 26, 2018 02:33
Network change detection on macOS
package main
/*
#cgo CFLAGS: -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1080
#cgo LDFLAGS: -framework CoreFoundation -framework SystemConfiguration
#include <SystemConfiguration/SystemConfiguration.h>
*/
import "C"
import "unsafe"

GUID Converter

When MSIs are installed on a Windows system, the GUID of a UpgradeCode or ProductCode are "formated" and then stored in the registry, this makes it difficult to locate related registry keys.

This gist provides a simple Golang script (with provided play link) to convert a GUID into a formated version that can be searched.

For the record, to convert a guid to the format used in the registry

@KatelynHaworth
KatelynHaworth / README.md
Created November 2, 2019 16:48
Reproduction code for golang/go#35314

Reproduction code for golang/go#35314

This gist contains example code to reproduce golang/go#35314, due to the privilege requirements of DuplicateTokenEx the code is designed to run as a service which then spawns a child process and logs the output of the child process to the Windows event log.

Written for go 1.13.4

Running the code