Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
Block or report user

Report or block peter279k

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peter279k
peter279k / index.html
Created Jun 2, 2020
Loading Animation in pure CSS3
View index.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Loading Animation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
</head>
<body>
@peter279k
peter279k / vi.txt
Created May 29, 2020
The vi/vim command cheatsheet and best practices
View vi.txt
i : 游標 前方 插入 字元
a : 游標 後方 插入 字元
O : 游標 上方 插入 空白行
o : 游標 下方 插入 空白行
del : 刪除一個字元
dd : 刪除一行
3dd : 刪除三行
@peter279k
peter279k / check_ftp.sh
Created May 20, 2020
Check FTP server is alive via lftp command
View check_ftp.sh
#!/bin/bash
cd $HOME
ftp_address="ftp_address"
ftp_user="ftp_user"
ftp_password="ftp_password"
lftp -c "open ${ftp_address} && user ${ftp_user} ${ftp_password} && ls" > "result_ftp_$(date '+%F_%H_%M').txt"
View disable_ping.sh
# Referenced by: https://linuxconfig.org/how-to-deny-icmp-ping-requests-on-ubuntu-18-04-bionic-beaver-linux
which ufw 2>&1 > /dev/null
if [[ $? != 0 ]]; then
echo 'Please install ufw package'
exit 1;
fi;
sudo_prefix=''
@peter279k
peter279k / replace_phpunit_fixtures.sh
Created Apr 24, 2020
This is let PHPUnit fixtures convert to correct prefix methods.
View replace_phpunit_fixtures.sh
#!/bin/bash
file_path=$1
if [[ ${file_path} == '' ]]; then
echo 'Please inut file_path'
exit 1;
fi;
if [[ -d $file_path ]]; then
@peter279k
peter279k / find_os_release.sh
Last active Apr 24, 2020
Find OS released dist name
View find_os_release.sh
#!/bin/bash
# Now it's available for Debian, Ubuntu, RedHat, CentOS and Fedora.
folder_root='/etc/'
dist_name='Unknown OS dist name'
release_paths=$(ls $folder_root 2>/dev/null | grep '\-release')
for release_path in $release_paths;
do
@peter279k
peter279k / create_docker_service.sh
Last active Apr 24, 2020
This is for creating restarted container as background service
View create_docker_service.sh
#!/bin/bash
# References: https://dev.to/suntong/autostart-docker-container-with-systemd-5aod
# Docker container running command: docker run -dit --restart always my-docker-image-name
# Don't forget to use --restart always option when running above command!
function ask_reboot () {
read -p 'Do you want to reboot system? [Y/n] ' reboot_ans
if [[ $reboot_ans == 'Y' ]]; then
You can’t perform that action at this time.