Skip to content

Instantly share code, notes, and snippets.

View carlosjhr64's full-sized avatar
🏠
At home

Carlos J. Hernandez carlosjhr64

🏠
At home
View GitHub Profile
@carlosjhr64
carlosjhr64 / reset-git-branch.sh
Created September 27, 2025 17:04
Script to reset and force-push a Git branch... Delete All Past Commits in a Git Branch!
#!/bin/bash
# Developed with help from Grok by xAI.
# Prompt user for Git directory
read -p "Enter the Git repository directory (e.g., $HOME/.cfg): " GIT_DIR
# Validate directory exists and is a Git repo
if [ ! -d "$GIT_DIR" ] || ! git --git-dir="$GIT_DIR" rev-parse --git-dir >/dev/null 2>&1; then
echo "Error: '$GIT_DIR' is not a valid Git repository directory."
exit 1
@carlosjhr64
carlosjhr64 / onepass.rb
Created September 29, 2011 18:25
xor strings onepass secrets
def onepass( target, *secrets )
output = target
secrets.select{|sec| !sec.nil?}.each do |secret|
output = output.bytes.inject(''){|string,byte| string + (byte^(secret[string.length] || 0.chr).ord).chr }
end
output
end