Skip to content

Instantly share code, notes, and snippets.

View TryTryAgain's full-sized avatar
🎯
Focusing

Michael Lawler TryTryAgain

🎯
Focusing
View GitHub Profile
@TryTryAgain
TryTryAgain / gotp.py
Created January 20, 2023 17:44
A simple "get OTP" python script utilizing pyotp: Supply an MFA seed and get the current and following/next OTP token readout, useful for getting a quick MFA OTP token provided a seed.
#!/usr/bin/env python
import pyotp
import argparse
# Variables grabbed from CLI arguments
parser = argparse.ArgumentParser(
    description='Supply MFA seed and get current and next OTP readout')
parser.add_argument(
    '-s', '--seed',
    required=True
@bassmanitram
bassmanitram / hack-selections.js
Created November 11, 2022 12:56
How to make Terraform 0.13 properly update a Terraform 0.12 state
/*
* Put this in a place where node can find it (referenced by $SCRIPT_HOME in the driver script)
* or figure out how to do this with JQ :)
*
* Basically, for every key that starts with "registry.terraform.io/hashicorp/" duplicate its value to
* that same key with "hashicorp" translated to "-" (keep the original property too)
*/
const fs = require("fs")
const output ={};
Object.entries(JSON.parse(fs.readFileSync( "/dev/stdin" ))).forEach(([key,value]) => {
@sarimarton
sarimarton / fix_github_copilot.sh
Last active November 29, 2024 12:45
Fix Github Copilot in dealing with self-signed certificates
# [2023-05-25] Added Copilot Chat, and VSCode Insiders
# [2023-05-20] Add VSCode Insiders variant
# [2023-02-22] Added Copilot Labs
# Fix Github Co-pilot self-signed cert problem
# See: https://github.com/orgs/community/discussions/8866#discussioncomment-3517831
# Note
#
# To make Github Copilot/Nightly/Labs/Chat work, you might need additional
@emidoots
emidoots / ramblings.md
Last active December 25, 2024 04:39
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@TryTryAgain
TryTryAgain / fix_copilot_proxy.sh
Created February 19, 2022 04:35
Fix GitHub Copilot behind Netskope or Zscalar or other Proxy
#!/bin/bash
_VSCODEDIR="$HOME/.vscode/extensions"
_COPILOTDIR=$(ls "${_VSCODEDIR}" | grep -E "github.copilot-[1-9].*") # For copilot
_COPILOTDEVDIR=$(ls "${_VSCODEDIR}" | grep "github.copilot-nightly-") # For copilot-nightly
_EXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDIR}/dist/extension.js"
_DEVEXTENSIONFILEPATH="${_VSCODEDIR}/${_COPILOTDEVDIR}/dist/extension.js"
if [[ -f "$_EXTENSIONFILEPATH" ]]; then
echo "Found Copilot Extension, applying 'rejectUnauthorized' patches to '$_EXTENSIONFILEPATH'..."
perl -pi -e 's/,rejectUnauthorized:[a-z]}(?!})/,rejectUnauthorized:false}/g' ${_EXTENSIONFILEPATH}
@z0ph
z0ph / find_loggroups_size.sh
Last active December 16, 2021 21:09
Find AWS CloudWatch LogGroups size + retention | sorted
aws logs describe-log-groups \
--query "logGroups[*].{LogGroup:logGroupName,VolumeSize:storedBytes,RetentionInDays:retentionInDays} | reverse(sort_by(@, &VolumeSize))" \
--output table
# Source: https://gist.github.com/d2f36b05bf959e5fc91497ea3f0dceb3
#######################################################
# Free Docker Desktop Alternative For Mac And Windows #
# https://youtu.be/LGNEG-t96eE #
#######################################################
# Referenced videos:
# - How to run local multi-node Kubernetes clusters using kind: https://youtu.be/C0v5gJSWuSo
# - K3d - How to run Kubernetes cluster locally using Rancher k3s: https://youtu.be/mCesuGk-Fks
@sarthakpranesh
sarthakpranesh / cleanMacVMs.sh
Last active April 12, 2025 21:58
Debloat Mac OS ( use at your own risk )
# I use MacOS VMs from github for iOS development.
# By no suprise they are a bit slow and have a lot of things I don't use
# Hence this script for lighter and better VM for my iOS development and builds
# GUI and animation related things to tweak
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
defaults write -g QLPanelAnimationDuration -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock launchanim -bool false
sudo sysctl debug.lowpri_throttle_enabled=0
@system123
system123 / google_auth.py
Created March 2, 2021 17:09
Google Auth TOTP code generator, just seed it with your MFA secret key and it'll generate codes exactly as Google Auth does.
def get_totp_token(secret, refresh_time=int(time.time())//30):
secret = secret.strip().replace(' ', '')
secret = secret.ljust((len(secret) + 7) & (-8) ,'=')
key = base64.b32decode(secret, True)
msg = struct.pack(">Q", refresh_time)
h = bytearray(hmac.new(key, msg, hashlib.sha1).digest())
o = h[19] & 15
h = str((struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000)
return h.zfill(6)
@broestls
broestls / Remove_VMwareTools.ps1
Last active April 24, 2025 04:54
Force removal of VMware Tools, Program Files, and Windows Services
# This script will manually rip out all VMware Tools registry entries and files for Windows 2008-2019
# Tested for 2019, 2016, and probably works on 2012 R2 after the 2016 fixes.
# This function pulls out the common ID used for most of the VMware registry entries along with the ID
# associated with the MSI for VMware Tools.
function Get-VMwareToolsInstallerID {
foreach ($item in $(Get-ChildItem Registry::HKEY_CLASSES_ROOT\Installer\Products)) {
If ($item.GetValue('ProductName') -eq 'VMware Tools') {
return @{
reg_id = $item.PSChildName;