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 | |
# Change UI mode for Ubuntu 20.04 | |
# Ref: https://superuser.com/a/1139020 | |
# When you want to use GUI X.Org | |
sudo telinit 5 | |
# When you want to use console | |
sudo telinit 3 |
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 | |
# To get 'com' from 'maps.google.com' -> parse string to get last field using delimiter | |
# Ref: https://stackoverflow.com/a/48032204 | |
echo 'maps.google.com' | awk -F. '{print $NF}' | |
# or | |
awk -F. '{print $NF}' <<< 'maps.google.com' |
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 | |
# Ref: https://stackoverflow.com/a/36394262 | |
echo "export LC_ALL=C" >> ~/.bashrc | |
source ~/.bashrc |
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 | |
# Ref: https://linux.die.net/man/1/dig | |
# Get IP of the DNS only | |
dig www.google.com +short |
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 | |
# Ref: https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs | |
# Set timezone | |
# Get available timezone: | |
# $ timedatectl list-timezones | |
sudo timedatectl set-timezone Asia/Seoul | |
# View logs |
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 | |
# Dealing with error: 'ERROR: readlink /var/lib/docker/overlay2: invalid argument' | |
# In kubernetes or docker | |
# Have to clear the docker cache | |
# docker prune will tidy the unused container, images, cache, etc. | |
docker system prune --all | |
docker volume prune |
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 | |
# Show BGP peering establishment status | |
sudo calico node status | |
kubectl describe blockaffinities | grep -E "Name:|Cidr:" | |
sudo birdc show protocols | |
sudo birdc show route protocol bgp2 |
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
def convert(input) | |
# Trim string | |
# @see https://stackoverflow.com/a/1000975 | |
input.strip! || input | |
# Reverse string | |
# '!' means modify the value in place | |
input.reverse! | |
# To uppercase string |
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
test("Expect error for normal function", () => { | |
expect(() => { | |
someAsyncFunction(); | |
}).toThrowError('Error message')); | |
}); | |
test("Expect error for async function", async () => { | |
async expect(async () => { | |
await someAsyncFunction(); | |
}).rejects.toThrowError('Error message')); |
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 | |
sudo ssh-keygen -A |