Skip to content

Instantly share code, notes, and snippets.

View brandonmartinez's full-sized avatar

Brandon Martinez brandonmartinez

View GitHub Profile
@brandonmartinez
brandonmartinez / zen.toml
Created July 15, 2024 05:51
My personal ohmyposh.dev configuration
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version = 2
final_space = true
console_title_template = '{{ .Shell }} in {{ .Folder }}'
[[blocks]]
type = 'prompt'
alignment = 'left'
newline = true
@brandonmartinez
brandonmartinez / disable-storage-accounts-shared-key-access.sh
Created April 29, 2024 14:59
Disables shared key access on all storage accounts in the given subscription.
#!/usr/bin/env bash
# Be sure to run az login before running
# run this script with a single parameter which is the subscription ID
# Exit if SUBSCRIPTION_ID is empty
if [ -z "$1" ]; then
echo "Please provide a valid subscription ID as the first parameter."
exit 1
fi
@brandonmartinez
brandonmartinez / CreatedAndRecordDateCleanup.sh
Created November 19, 2023 19:38
A script that will take videos named in the YYYY-MM-DD-HH-mm-ss* format and use that to update the file created date time and EXIF created date times. Meant to run on macOS (due to `touch` and `stat` differences from linux).
#!/bin/zsh
DEBUG=${DEBUG:-false}
fullpath=$1
log_header() {
RED=$(tput setaf 1)
WHITE=$(tput setaf 7)
RESET=$(tput sgr0)
@brandonmartinez
brandonmartinez / printer-Ender3S1Plus.cfg
Last active January 7, 2024 12:00
My klipper printer.cfg for the Ender 3 S1 Plus
# Based on: https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender3-s1plus-2022.cfg
# This file contains pin mappings for the stock 2022 Creality Ender 3
# S1 Plus. To use this config check the STM32 Chip on the Mainboard,
# during "make menuconfig" select accordingly either the
# STM32F103 with "28KiB bootloader" or the STM32F401 with
# "64KiB bootloader" and serial (on USART1 PA10/PA9) for both.
# For a direct serial connection, in "make menuconfig" select
# "Enable extra low-level configuration options" and Serial
# (on USART2 PA3/PA2), which is on the 10 pin IDC cable used
@brandonmartinez
brandonmartinez / StabilizeVideosInFolder.sh
Created July 30, 2022 05:57
Search a folder for MP4 files and stabilize them with ffmpeg and vid.stab.
#!/bin/sh
####################################################################################
# This script searches the passed in directory for video files (*.mp4, *.mov, *.m4v)
# and stabilizes them using ffmpeg and libvidstab (required before running). It will
# create a transform file (*.trf), then use the information to create a new video
# with a `-stabilized` suffix.
#
# Based on https://www.paulirish.com/2021/video-stabilization-with-ffmpeg-and-vidstab/
####################################################################################
@brandonmartinez
brandonmartinez / portal.azure.com.hideuserinformation.user.js
Last active March 4, 2022 19:51
Tampermonkey | Azure Portal | Hide User Information
// ==UserScript==
// @name Azure Portal | Hide User Information
// @version 0.1
// @description Hides the signed in user name and avatar in the Azure portal.
// @author Brandon Martinez
// @grant none
// @include https://portal.azure.com/*
// @include https://ms.portal.azure.com/*
// ==/UserScript==
@brandonmartinez
brandonmartinez / ang.ps1
Created May 3, 2021 20:32
Azure Name Generator
#!/usr/bin/env pwsh
param (
[Parameter(Position = 1, mandatory = $true)]
[string]$resourceType,
[Parameter(Position = 2, mandatory = $true)]
[string]$workload,
[Parameter(Position = 3, mandatory = $true)]
[string]$environment,
[Parameter(Position = 4, mandatory = $true)]
@brandonmartinez
brandonmartinez / ExpressionExtensions.cs
Created October 5, 2018 20:50
Wrote some code for a project, but ended up scrapping it since we refactored and simplified the calling code. Just wanted to keep the code in case I need to mess with expressions for property getters and setters again.
using System;
using System.Linq.Expressions;
using System.Reflection;
namespace MyProject.Services.SystemExtensions
{
public static class ExpressionExtensions
{
/// <summary>
/// Compiles a getter Func from an expression to access a property
#Requires -Version 3.0
param($websiteNames, $jobname, $jobtype, $packOutput, $slotName = "")
$VerbosePreference = "continue"
$ErrorActionPreference = "continue"
# Helper Functions (based on or from https://github.com/aspnet/vsweb-publish/blob/master/publish-module.psm1)
function Get-MSDeploy{
[cmdletbinding()]
@brandonmartinez
brandonmartinez / vncboot
Created February 13, 2015 19:14
Raspberry Pi VNC Boot Script
# First configure the user you want to run this under - this will generally be pi, unless you've created your own users
export USER='pi'
eval cd ~$USER
# Check the state of the command - this'll either be start or stop
case "$1" in
start)
# if it's start, then start vncserver using the details below
su $USER -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565'