This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Source of this solution: https://askubuntu.com/a/1242739 | |
sudo su - | |
mkdir /etc/gcrypt | |
echo all >> /etc/gcrypt/hwf.deny | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if given port is in use | |
netstat -an | grep ${PORT} | |
# Check all TCP listening port and its process name | |
netstat -nlpt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/powershell | |
# Enable / Disable hypervisor to use WSL2 with VirtualBox | |
# ref: https://github.com/MicrosoftDocs/WSL/issues/798#issuecomment-1063862157 | |
# Enable hypervisor | |
bcdedit /set hypervisorlaunchtype auto | |
# Disable hypervisor | |
bcdedit /set hypervisorlaunchtype off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# download .deb from apt | |
# download the packages with all dependencies included from apt | |
# `grep -v "i386"` will discard all dependencies with i386 architecture | |
# ref: https://stackoverflow.com/a/45489718 | |
# usage: | |
# $1: package name (only one permitted) | |
# $2: package save directory path (mkdir if path not found) | |
function dl_deb { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
go test -run __functionName__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://stackoverflow.com/a/1371283 | |
result=${PWD##*/} # to assign to a variable | |
printf '%s\n' "${PWD##*/}" # to print to stdout | |
# ...more robust than echo for unusual names | |
# (consider a directory named -e or -n) | |
printf '%q\n' "${PWD##*/}" # to print to stdout, quoted for use as shell input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mysqldump -u username -p databasename > filename.sql # dump database | |
mysqldump -u username -p databasename tablename1 tablename2 > filename.sql #dump tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ssh example | |
ssh -T -o StrictHostKeyChecking=no ${USERNAME}@${IP} | |
# scp example | |
# Remeber `scp [OPTIONS] [FROM] [TO]` | |
# 1) send | |
scp -T -o StrictHostKeyChecking=no -r ${DIRECTORY} ${USERNAME}@${IP}:${PATH} | |
# 2) receive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ref: https://stackoverflow.com/a/28786207 | |
cat - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl get events --field-selector type=Warning # get all 'Warning' events | |
kubectl logs $POD_NAME |
OlderNewer