Skip to content

Instantly share code, notes, and snippets.

View iamacarpet's full-sized avatar

Samuel iamacarpet

View GitHub Profile
@iamacarpet
iamacarpet / Boot
Last active February 8, 2024 14:42
Glazier UEFI network boot (Secure Boot enabled)
#!ipxe
# Some menu defaults
set menu-timeout 60000
set submenu-timeout ${menu-timeout}
isset ${menu-default} || set menu-default exit
###################### MAIN MENU ####################################
@iamacarpet
iamacarpet / Boot-Glazier.ps1
Last active January 25, 2024 09:50
Glazier WinPE boot from existing Windows install
cd C:\Windows\Temp
& curl.exe --output glazier.iso https://storage.googleapis.com/example-glazier-files/OSDCloud-WinPE-Glazier.iso
Mount-DiskImage C:\Windows\Temp\glazier.iso -PassThru
$driveLetter = ($mountResult | Get-Volume).DriveLetter
Copy-Item -Path $( -join($driveLetter, ":\sources\") ) -Destination C:\sources -Recurse
mkdir C:\boot
Copy-Item -Path $( -join($driveLetter, ":\boot\boot.sdi" ) ) -Destination C:\boot\boot.sdi
Dismount-DiskImage C:\Windows\Temp\glazier.iso
@iamacarpet
iamacarpet / config.yaml
Created January 31, 2023 15:23
Google Cloud Ops Agent: Windows Server DHCP Audit Log Parser
logging:
receivers:
dhcp_audit:
type: files
include_paths:
- C:\Windows\System32\dhcp\DhcpSrvLog-*.log
record_log_file_path: true
processors:
exclude_dhcp_guff:
type: exclude_logs
@iamacarpet
iamacarpet / Check-Dbx.ps1
Last active May 9, 2022 10:45 — forked from out0xb2/Check-Dbx.ps1
Parses signature data from the pk, kek, db, and dbx UEFI variables.
Write-Host "Checking for Administrator permission..."
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Insufficient permissions to run this script. Open the PowerShell console as administrator and run this script again."
Break
} else {
Write-Host "Running as administrator: continuing execution..." -ForegroundColor Green
}
$patchfile = $args[0]
@iamacarpet
iamacarpet / 4.41.16.txt
Created November 26, 2021 21:43
Ubiquiti G3 Bullet / G3 Flex firmware for standalone mode
https://fw-download.ubnt.com/data/uvc/c50c-s2l-4.41.16-bcf8b0e1872741b780e45c3d4114f711.bin
@iamacarpet
iamacarpet / composer.json
Last active October 19, 2021 14:11
Simplistic GCP Secret Manager usage from PHP
{
"require": {
"google/cloud": "^0.171.0"
}
}
@iamacarpet
iamacarpet / teamsupdate.ps1
Created September 23, 2021 11:05
Force a Microsoft Teams update
$ProgressPreference = 'SilentlyContinue'
$TeamsSettings = $HOME + "\AppData\Roaming\Microsoft\Teams\settings.json"
$Setting = Get-Content $TeamsSettings -ErrorAction Continue | ConvertFrom-Json | Select Version
$Version = $Setting.Version
echo "Checking for updates..."
$UpdateInfo = curl "https://teams.microsoft.com/desktopclient/update/$Version/windows/x64?ring=general"
$UpdateData = $UpdateInfo | ConvertFrom-json
@iamacarpet
iamacarpet / app.yaml
Created October 18, 2018 08:30
App Engine Go 1.11 memcache proof
runtime: go111
func openFileReader(ctx context.Context, bucketName, fileName string) (*storage.Reader, error) {
client, err := storage.NewClient(ctx)
if err != nil {
log.Errorf(ctx, "Error getting GCS Client: %s", err)
return nil, err
}
defer client.Close()
bucket := client.Bucket(bucketName)
@iamacarpet
iamacarpet / gist:2944f1ee372ee0a44d07a2351ceb39b3
Created January 17, 2018 15:20
BigQuery (Legacy SQL) - Cloudflare Enterprise Log Share - User Agent Browser Version
-- Looking towards the "Legacy TLS" turndown in June 2018,
-- we needed to analyse which devices / browsers are still accessing, by parsing the User Agent.
-- This is in BigQuery Legacy SQL, with field names based on Cloudflare's Enterprise Log Share data.
CASE
WHEN ClientRequestUserAgent LIKE '%Windows Phone%' THEN CONCAT('Windows Phone/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Windows Phone ([0-9\.]+);'), REGEXP_EXTRACT(ClientRequestUserAgent, r'Windows Phone ([0-9\.]+);'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%MSIE%' THEN CONCAT('MSIE/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'MSIE ([0-9\.]+)'), REGEXP_EXTRACT(ClientRequestUserAgent, r'MSIE ([0-9\.]+)'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%Trident%' THEN CONCAT('MSIE/Trident/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Trident/([0-9\.]+)'), REGEXP_EXTRACT(ClientRequestUserAgent, r'Trident/([0-9\.]+)'), 'UNKNOWN'))
WHEN ClientRequestUserAgent LIKE '%Firefox%' THEN CONCAT('Firefox/', IF(REGEXP_MATCH(ClientRequestUserAgent, r'Fi