Skip to content

Instantly share code, notes, and snippets.

@spryffee
spryffee / add-fontawesome-to-rails
Last active March 10, 2023 08:50
How to add fontawesome to Rails project using importmaps
bin/importmap pin @fortawesome/fontawesome-free
# add to app/javascript/applications.js
import "@fortawesome/fontawesome-free"
# add to config/importmap.rb
pin "@fortawesome/fontawesome-free", to: "https://ga.jspm.io/npm:@fortawesome/[email protected]/js/all.js"
@spryffee
spryffee / gist:9189dd4dcee2eb8d3d4ac6199e1d5f9e
Last active September 28, 2022 08:10
Adding your own, trusted CA certificates in RedHat and Debian derivatives
RedHat expects:
PEM or DER encoded,
Regardless of extension,
Added into /etc/pki/ca-trust/source/anchors,
After which you run: update-ca-trust
Debian expects:
PEM encoded,
@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 / fping
Created December 3, 2020 07:54
discover network with fping
fping -ag -r 1 192.168.1.0/23
@spryffee
spryffee / Vagrantfile
Last active December 3, 2020 07:50
Bootstrap VM
# -*- mode: ruby -*-
# vi: set ft=ruby :
username = "agasanov"
interface_bridged = "wlp61s0"
ssh_key = "id_ed25519.pub"
Vagrant.configure("2") do |config|
config.vm.box = "centos/8"
config.vm.box_check_update = false
@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."