Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar
🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
View GitHub Profile
@peter279k
peter279k / crontab_editor.sh
Created June 27, 2020 19:36
Set the default editor for crontab -e command
#!/bin/bash
# References:
# https://superuser.com/questions/281617/change-default-text-editor-for-crontab-to-vim
editor_name=$1
if [[ ${editor_name} == "" ]]; then
echo "The editor name is not set. Using the vim.basic as editor by default..."
editor_name="vim.basic"
@peter279k
peter279k / upgrade_apache.sh
Created June 27, 2020 19:27
This is about upgrading Apache server on Ubuntu 16.04 and Ubuntu 18.04
#!/bin/bash
# References:
# https://www.mysterydata.com/update-apache-2-4-to-latest-version-on-ubuntu-16-04-server-vestacp/
sudo_prefix="sudo "
if [[ ${USER} == "root" ]]; then
sudo_prefix=""
else
@peter279k
peter279k / fix_ubuntu_meta_release.sh
Last active June 27, 2020 18:40
This is about how to fix "failed-to-connect-to-http-changelogs-ubuntu-com-meta-release"
#!/bin/bash
# References
# https://www.cnblogs.com/xsjzhao/p/11001541.html
# https://askubuntu.com/questions/919441/failed-to-connect-to-http-changelogs-ubuntu-com-meta-release
# https://ubuntuforums.org/showthread.php?t=2391641
# It causes because of temporary network issue.
# The resolved solution is as follows:
@peter279k
peter279k / nginx-default
Last active December 15, 2020 11:38
The customized Packaggist mirror installer
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.