Skip to content

Instantly share code, notes, and snippets.

View rizkysyazuli's full-sized avatar

Rizky Syazuli rizkysyazuli

View GitHub Profile
@rizkysyazuli
rizkysyazuli / mac.sh
Last active June 13, 2021 15:20
[Shell - macOS] Useful macOS specific shell commands #shell #mac
# Brew commands
brew cleanup
rm -rf $(brew --cache)
@rizkysyazuli
rizkysyazuli / php.sh
Last active June 10, 2021 17:13
[Shell - PHP] PHP command line utilities #php #shell
# Check loaded config
php --ini
# PHP Info
php -i
# Restart PHP-FPM
systemctl restart php-fpm.service
systemctl restart php5-fpm.service # version specific
@rizkysyazuli
rizkysyazuli / https.sh
Last active November 5, 2022 06:34
[Shell - HTTP] Useful http & web related commands
# Download the SSL certificate from a website
echo | openssl s_client -servername NAME -connect HOST:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > FILENAME.cer
# copy ssh keys to remote server
ssh-copy-id remote_username@server_ip_address
# output recent server log
# https://explainshell.com/explain?cmd=tail+-f+%2Fpath%2Fto%2Flogs%2Ferror.log+%7C+grep+%27string%27
tail -f /path/to/logs/error.log | grep 'string'
cat /path/to/logs/error.log | grep 'string'
@rizkysyazuli
rizkysyazuli / about.md
Last active August 7, 2020 09:24
US States & Cities select menu

About

What is this?

Example JS for populating select menus with US states and the all the cities in it. The city select will be updated based on the selected state.

Data source

@rizkysyazuli
rizkysyazuli / dev.sh
Last active November 22, 2022 16:59
[Shell - File Management] Files management utilities #shell
# a typical rsync file transfer upload command
# https://explainshell.com/explain?cmd=rsync+-uavl+--exclude-from%3D%27exclude-list%27+--delete+.%2F+%24USER%40%24HOST%3A%24UPLOAD_PATH
rsync -uavl --exclude-from='exclude-list.txt' --delete ./ user@host:/upload/path
# rsync copy folders
rsync -avzh --exclude=dir/ /source /destination/
# rsync download remote directory
rsync -avzh user@host:/target/path ./destination
@rizkysyazuli
rizkysyazuli / git-commands.sh
Last active July 31, 2023 03:03
[Shell - Git] Obscure but useful Git commands #git #shell
# check repo size
git count-objects -vH
# clone a mirror copy of a repo
git clone --mirror <repo-url>
# git merge dry run
git merge --no-commit --no-ff branch_name
# git export as zip
@rizkysyazuli
rizkysyazuli / nginx-commands.sh
Last active November 4, 2020 16:58
[Shell - Nginx Commands] #nginx #centos #ubuntu
# Start
sudo systemctl start nginx
sudo service nginx start
# Stop
sudo systemctl stop nginx
sudo service nginx stop
# Restart
sudo systemctl restart nginx
@rizkysyazuli
rizkysyazuli / apache-commands.sh
Last active February 21, 2020 11:27
[Shell - Apache Commands] #ubuntu #centos #apache
# Ubuntu
sudo service apache2 start
sudo service apache2 stop
sudo service apache2 restart
# CentOS 7.x or newer
sudo systemctl start httpd.service
sudo systemctl stop httpd.service
sudo systemctl restart httpd.service
@rizkysyazuli
rizkysyazuli / shell-utils.sh
Last active July 5, 2021 16:45
[Shell - Utilities] Useful Linux shell commands & utilities #shell #unix
# check active services
# https://explainshell.com/explain?cmd=ps+aux+%7C+grep+%27string%27
ps aux | grep 'service_name'
ps -ef | grep service_name
# check unix OS
cat /etc/os-release
hostnamectl
lsb_release -a # might not work in every distro
@rizkysyazuli
rizkysyazuli / .editorconfig
Last active February 20, 2020 16:06
[Dotfiles - WP Theme Dev Settings] Contains rules for EditorConfig, stylelint, ESLint, and PHP_CodeSniffer that follows WordPress coding standards. Uses and Gulp + BrowserSync for auto reload. #wordpress #development #linter #dotfiles
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4