Skip to content

Instantly share code, notes, and snippets.

@OnceUponALoop
OnceUponALoop / ansi-escape-sequences.md
Created September 13, 2024 18:50
ANSI Escape Sequences

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@OnceUponALoop
OnceUponALoop / stackrox-logo.md
Last active August 23, 2024 05:14
StackRox Logo

StackRox-integration-logo

@OnceUponALoop
OnceUponALoop / plantuml.sh
Created July 21, 2024 01:07
This script acts as a wrapper for the PlantUML jar file, making it easier to call the jar file with the appropriate arguments. It allows specifying the path to the Java binary and the PlantUML jar file via command-line arguments or environment variables, and it validates the existence of these files before execution.
#!/usr/bin/env bash
################################################################################
# plantuml.sh - A script to wrap PlantUML jar execution
#
# Author: Firas AlShafei
# Created: 2024.07.20
# Last Modified: 2024.07.20
#
# Description:
@OnceUponALoop
OnceUponALoop / encode_pumls.sh
Last active July 20, 2024 21:13
This script searches for files with a specified pattern (e.g., *.puml) in a given directory, runs them through the PlantUML command to encode them, and saves the output in a specified directory.
#!/usr/bin/env bash
################################################################################
# encode_puml.sh - A script to find and encode PlantUML files
#
# Author: Firas AlShafei
# Created: 2024.07.20
# Last Modified: 2024.07.20
#
# Description:
@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
@OnceUponALoop
OnceUponALoop / grype-html.tmpl
Last active November 1, 2024 06:28
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 / 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 / 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 / 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 / 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