Skip to content

Instantly share code, notes, and snippets.

View charltonstanley's full-sized avatar

Charlton Stanley charltonstanley

View GitHub Profile
@kalihman
kalihman / AWS4-Request-Signer.ps1
Last active November 2, 2023 05:15
Powershell AWS4 Signer for STS GetCallerIdentity Action
# Define Helper Functions
function Get-Sha256Hash ($StringToHash) {
$hasher = [System.Security.Cryptography.SHA256]::Create()
$Hash = ([BitConverter]::ToString($hasher.ComputeHash([Text.Encoding]::UTF8.GetBytes($StringToHash))) -replace '-','').ToLower()
Write-Output $Hash
}
function ConvertTo-SortedDictionary($HashTable) {
$SortedDictionary = New-Object 'System.Collections.Generic.SortedDictionary[string, string]'
foreach ($Key in $HashTable.Keys) {
@ShannonScott
ShannonScott / readme.md
Last active May 6, 2024 06:15
[Transcode h265] Use ffmpeg to transcode a video to h.265 / hvc1 which will play natively on a Mac (and Linux). #tags: video, python, ffmpeg
#!/bin/bash
 set -e
 SECRETS_MANAGER="aws secretsmanager"
 REGION="ap-southeast-1"
 
 function get_secret {
$($SECRETS_MANAGER get-secret-value --secret-id $secret --query SecretString --output text --region $REGION)
 }
 
 function parse_secret {
@lzybkr
lzybkr / Get-AmIPwned.ps1
Last active August 21, 2023 08:16
Query haveibeenpwned.com
<#
.SYNOPSIS
Reports if your password is pwned by querying haveibeenpwned.com
.DESCRIPTION
Query haveibeenpwned.com to see if a password has appeared in a breach.
The query sends the first 5 characters of the SHA1 hash, so the query should be considered safe and anonymous.
@Saissaken
Saissaken / Update git fork with tags.sh
Last active April 20, 2024 18:10
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active May 7, 2024 22:00
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: