Skip to content

Instantly share code, notes, and snippets.

@OnceUponALoop
OnceUponALoop / pulp-linkify.md
Created June 8, 2020 16:30
Pulp v3 Bookmarklet (PulpLinkify)

Converts Pulp v3 API urls to links I'm sure it can be more efficient but it's a quick hack for now.

Linkify Pulp Script

var pp = document.getElementsByClassName('prettyprint');

for (var i = 0; i < pp.length; i++){

  var matches = pp[i].getElementsByClassName('str');
@OnceUponALoop
OnceUponALoop / favicon.js
Created August 10, 2020 20:55 — forked from billti/favicon.js
Create inline GIF favicons
/* Bill Ticehurst, 2020
Emits a minimal 16 x 16 gif suitable for use as an inline favicon
GIF spec at https://www.w3.org/Graphics/GIF/spec-gif89a.txt for the structure
Favicon formats supported at https://en.wikipedia.org/wiki/Favicon
For a transparent GIF (color_table = false, depend_on_background = true) this emits:
<link rel="icon" href="data:image/gif;base64,R0lGODlhEAAQAAAAACwAAAAAAQABAAACASgAOw==">
@OnceUponALoop
OnceUponALoop / puml-viewer.adoc
Last active October 1, 2020 21:56
Testing plantuml viewer from capitalone

@startuml

title "Push Notification Enrollment"

hide footbox autonumber "[0] "

participant "Developer" as User << (U, #ccebc5) user >> actor User as _user << (U, #ccebc5) user >> participant "Orchestration Layer" as Orch << (C, #b3cde3) capital one >>

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@OnceUponALoop
OnceUponALoop / profile.ps1
Last active April 9, 2021 21:12
Set colors of powershell console to indicate administrative mode
#--------------------------------
# Set Admin Mode console colors
#--------------------------------
# Check if running in admin mode
$IsElevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
Function Redraw-Screen{
# Save current console content
$bufferWidth = $host.ui.rawui.BufferSize.Width
@OnceUponALoop
OnceUponALoop / set-admin-colors.sh
Created April 9, 2021 22:21
Bash profile - set console color if admin mode in msys
if [ $(net session > /dev/null 2>&1; echo $?) -eq 0 ]; then
# Set Background Color
echo -ne '\e]11;#800F00\a'
# Set PS1
export PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[7m\][Admin]\[\033[0m\] \[\033[32m\]\u \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n# '
else
#Set PS1
export PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ '
@OnceUponALoop
OnceUponALoop / generate-ca-bundle.sh
Created June 10, 2022 22:49
Generate ca-bundle from Windows Store
# Root CA Bundle - autogenerate from Windows store
# Location of bundle
# I chose not to override the mingw64 store in /etc/ssl to avoid having to request admin elevation
CertFile=$HOME/.certs/ca-bundle.pem
# Only recreate once a day
if [ "$(date -r $HOME/.certs/ca-bundle.pem +%F 2>/dev/null)" != "$(date +%F)" ]; then
mkdir -p $HOME/.certs
ps_script='
if (-not $ENV:CertFile) { $ENV:CertFile="$ENV:USERPROFILE\.certs\ca-bundle.pem" }
@OnceUponALoop
OnceUponALoop / sharepoint-upload.py
Created July 20, 2023 06:49
Manual SAML Auth with curl against a federated sharepoint server, once authenticated use the token to upload a file.
#!/bin/python
#===================================================================================
# Title : sharepoint-upload.py
#
# Description : SAML Authentication example against a sharepoint site
# uploads a file to a document library after auth
#
# Author : Firas AlShafei
#
# Version : v1.0
@OnceUponALoop
OnceUponALoop / grype-html.tmpl
Last active October 1, 2025 05:42
Grype HTML Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vulnerability Report</title>
<!-- Template Metadata-->
<meta name="author" content="OnceUponALoop">
<meta name="version" content="1.0.0">
@OnceUponALoop
OnceUponALoop / plantuml_codec.py
Created July 20, 2024 04:35
This script provides functions to encode and decode PlantUML text. The encoding process compresses the text using zlib and then encodes it using a custom base64-like encoding suitable for PlantUML servers. The decoding process reverses these steps. It also allows extracting and decoding PlantUML text from SVG comments.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
PlantUML Encoder/Decoder
========================
This script provides functions to encode and decode PlantUML text. The encoding
process compresses the text using zlib and then encodes it using a custom
base64-like encoding suitable for PlantUML servers. The decoding process
reverses these steps. It also allows extracting and decoding PlantUML text