Skip to content

Instantly share code, notes, and snippets.

@spryffee
spryffee / recover-admin-password-windows10
Last active January 19, 2022 09:37
recover admin password windows 10
# Boot from Windows 10 Installation ISO https://www.microsoft.com/en-au/software-download/windows10
Shift+F10 # open a DOS command prompt window
# Create a Secondary (Local) Administrator User
# Note: it may fail if system disk is not D:, then type "Dir E:", "Dir F:" etc until you find which drive is system
Move D:\Windows\System32\utilman.exe D:\Windows\System32\utilman.bak
Copy D:\Windows\System32\cmd.exe D:\Windows\System32\utilman.exe
wpeutil reboot
# allow Windows to boot up normally, not from ISO
# bring up a command prompt at the login screen by clicking the "Ease of Access" option on the Windows 10 login screen.
@spryffee
spryffee / recover-root-password-centos
Last active December 18, 2020 21:07
recover root password in CentOS
e # boot to the GRUB edit mode
quiet ... rd.break # rd.break at the end of the line starting with kernel=
ctrl-x
mount -o remount,rw /sysroot/
chroot /sysroot
passwd
touch /.autorelabel # update selinux information
exit
logout
# wait for the file-system relabeling to complete
@spryffee
spryffee / .bashrc
Last active November 29, 2020 07:36
bashrc addon
# terminal color
PS1='\[\033[37m\]\u\[\033[36m\]@\[\033[36m\]\h:\[\033[1;36m\]\w\[\033[31m\]\$\[\033[0m\] '
# aleases
alias up="sudo apt -y update"
alias updates="apt --just-print upgrade 2>&1 | perl -ne 'if (/Inst\s([\w,\-,\d,\.,~,:,\+]+)\s\[([\w,\-,\d,\.,~,:,\+]+)\]\s\(([\w,\-,\d,\.,~,:,\+]+)\)? /i) {print \"PROGRAM: \$1 INSTALLED: \$2 AVAILABLE: \$3\n\"}' | column -s \" \" -t"
alias upgrade-specify='sudo apt -y --only-upgrade install'
alias upgrade="sudo apt -y upgrade"
alias sshconfig="${EDITOR:-nano} ~/.ssh/config"
alias bashrc="${EDITOR:-nano} +120 ~/.bashrc && source ~/.bashrc && echo Bash config edited and reloaded."