Useful code snippets and scripts¶
Enable paste on websites that block it¶
Don't F&_k with Paste
// Prevents websites from blocking copy/paste
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
Get IPV4¶
Get IPV6¶
List versions of PyPI package¶
List the available versions of a PyPi package
curl -s https://pypi.org/pypi/<package>/json | jq '.releases | keys | .[]'
Git: Sign commits¶
Sign all commits from the commit id
git rebase --exec 'git commit --amend --no-edit -n -S' -i <commit id>
Resign all commits in a repository
git rebase --exec 'git commit --amend --no-edit --no-verify -S' -i --root
Keep the commited date when signing using above commands
git rebase --committer-date-is-author-date -i --root
Delete local git branches except a few
git branch | grep -v "main" | grep -v "master" | xargs git branch -D
Powershell¶
Restart windows into BIOS
Restart windows into Safe Mode
Restart windows into Normal Mode
Shutdown windows
Get WIFI Passwords on windows
(netsh wlan show profiles) | Select-String "\:(.+)$" | %{$name=$_.Matches.Groups[1].Value.Trim(); $_} | %{(netsh wlan show profile name="$name" key=clear)} | Select-String "Key Content\W+\:(.+)$" | %{$pass=$_.Matches.Groups[1].Value.Trim(); $_} | %{[PSCustomObject]@{ PROFILE_NAME=$name;PASSWORD=$pass }} | Format-Table –Wrap