Skip to content

Instantly share code, notes, and snippets.

View WellingtonEspindula's full-sized avatar

Wellington M. Espindula WellingtonEspindula

View GitHub Profile
@WellingtonEspindula
WellingtonEspindula / find_next_word.sh
Last active April 24, 2024 22:36
Grep to select the word right after the searched word
grep --color -P '(?<=$SEARCHED_WORD\=)(\s+)?\K([^ ]*)
@WellingtonEspindula
WellingtonEspindula / .bashrc
Last active April 25, 2024 11:14
Comma-based CSV file reader for .bashrc
# Bash utility aliases/functions to read huge CSV files
# The both functions read the first n lines from a file
# Normal version (open the columnized file in less)
readcsv() {
local lines=$1 \
filename=$2
head -n "$lines" "$filename" | column -tns ',' | less -S
}
@WellingtonEspindula
WellingtonEspindula / rotate.py
Created November 9, 2023 21:08
Rotate x times chars (using unsigned char) in a byte string (useful to desobfuscate secrets in C code)
def rotate(byte_string, x_times):
return "".join( [ chr( (byte + x_times) % 256) for byte in memoryview(byte_string).tolist()])
# exemple
rotate(b'\x74\x66\x75\x66\x64\x62\x74\x75\x73\x70\x6f\x70\x6e\x7a\x00', 0xff)