Skip to content

Instantly share code, notes, and snippets.

Avatar

Rizky Syazuli rizkysyazuli

View GitHub Profile
@rizkysyazuli
rizkysyazuli / about.md
Last active Aug 7, 2020
US States & Cities select menu
View about.md

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 Apr 12, 2020
[Shell - File Management] Files management utilities #shell
View dev.sh
# 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 Mar 6, 2020
[Shell - Git Commands] Obscure but useful Git commands #git #shell
View git-commands.sh
# 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
@rizkysyazuli
rizkysyazuli / nginx-commands.sh
Last active Nov 4, 2020
[Shell - Nginx Commands] #nginx #centos #ubuntu
View nginx-commands.sh
# 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 Feb 21, 2020
[Shell - Apache Commands] #ubuntu #centos #apache
View apache-commands.sh
# 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 Apr 16, 2020
[Shell - Utilities] Useful Linux shell commands & utilities #shell #unix
View shell-utils.sh
# check active services
# https://explainshell.com/explain?cmd=ps+aux+%7C+grep+%27string%27
ps aux | grep 'service_name'
# check unix OS
cat /etc/os-release
hostnamectl
lsb_release -a # might not work in every distro
# Connect to OpenVPN
@rizkysyazuli
rizkysyazuli / .editorconfig
Last active Feb 20, 2020
[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
View .editorconfig
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
@rizkysyazuli
rizkysyazuli / idr-check.js
Last active Feb 21, 2020
[Bookmarklet - Bitcoin.co.id] Get estimate values of your crypto currency portfolio in Rupiah. Probably no longer works. #bookmarklets
View idr-check.js
/*
* Author: Rizky Syazuli <br4inwash3r@gmail.com>
* This code snippet is used to show live IDR estimate of your crypto assets in Bitcoin.co.id
* Used as a bookmarklet. Go here to do convert any JS snippets into a bookmarklet: https://bookmarkify.it
*/
if (window.location.href !== 'https://vip.bitcoin.co.id/market') {
alert(`Your're not in VIP spot market page`);
}
@rizkysyazuli
rizkysyazuli / tail-slack.sh
Last active Feb 20, 2020
[Shell - Server Log to Slack] Sends server log entries to Slack via webhook #webhook #slack #apache #nginx #shell
View tail-slack.sh
#!/bin/bash
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2";
done
# to monitor a single session
# ./tail-slack.sh "/var/log/nginx/access-web.log" "https://hooks.slack.com/services/..." " 500 "
View gem.sh
#!/usr/bin/env bash
# Originally from: https://bitbucket.org/snippets/rzky/5Kp6k/ruby-gems-installer
# Install Ruby Version Manager (RVM)
# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
# curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1
# rvm use 2.1 --default
# Essentials