This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$secretsFilePath = "secrets.json" | |
if (-Not (Test-Path -Path $secretsFilePath)) { | |
Write-Output "secrets.json not found... creating..." | |
$tenantId = Read-Host -Prompt "Enter your Tenant ID" | |
$clientId = Read-Host -Prompt "Enter your Client ID" | |
$clientSecret = Read-Host -Prompt "Enter your Client Secret" | |
$secretsContent = @{ | |
tenantId = $tenantId | |
clientId = $clientId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Update package lists | |
sudo apt update | |
# Install dependencies for building Python versions | |
sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ | |
libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils \ | |
tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Brandon Dalton | |
# Date: 20240828 / Original Red Canary ATH 20240116 | |
# | |
# Description: Returns the list of supported file types (CFBundleDocumentTypes) in Archive Utility.app | |
# Reference: https://github.com/redcanaryco/AtomicTestHarnesses/blob/6b00e8f41062da2c424ab4e7ec71bd3ec3a6f112/posix/src/posixath/utils/common.py#L530 | |
# | |
import os | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// x2p.c | |
// MachXPC | |
// | |
// Created by Brandon Dalton on 04/09/2024. | |
// | |
#include <xpc/xpc.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Compression | |
import OSLog | |
// Compress JSON representation with the Apple recommended compression algo LZFSE | |
// https://developer.apple.com/documentation/compression/algorithm/lzfse | |
public func getCompressedJSON(from jsonString: String) -> Data { | |
var sourceBuffer = Array(jsonString.utf8) | |
let destinationBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: jsonString.count) | |
let algorithm = COMPRESSION_LZFSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// csr_check.swift | |
// csr_check | |
// | |
// Created by Brandon Dalton on 01/11/24. | |
// | |
// Compile: `swiftc -import-objc-header SystemConfig-Bridging-Header.h csr_check.swift -o csr_check.o` | |
// | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FileMetadataHelpers.swift | |
// FileMetadataHelpers | |
// | |
// Created by Brandon Dalton on 10/7/23. | |
// | |
import Foundation | |
/// Helper functions for working with file metadata. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ | |
--headless --incognito --dump-dom https://github.com > /tmp/github.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Set up `gcloud` cli on macOS and Linux | |
# Check which OS we're on | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
OS="linux" | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
OS="darwin" | |
else | |
echo "Unsupported OS: $OSTYPE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function speak_ollama() { | |
if ! command -v ollama &> /dev/null; then | |
echo "Error: ollama is not installed." | |
return 1 | |
fi | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: speak_ollama <file_path> <model>" | |
return 1 | |
fi |
NewerOlder