Skip to content

Instantly share code, notes, and snippets.

Tung Nguyen ralavay

  • Ralavay
  • Singapore
Block or report user

Report or block ralavay

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
@ralavay
ralavay / json
Created Dec 30, 2019
grafana-cert-manager.json
View json
{
"__inputs": [],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "6.3.4"
},
{
@ralavay
ralavay / cert-check.sh
Last active Dec 28, 2018
Show SSL cert expiration date
View cert-check.sh
# Put this into ~/.profile
# Usage:
# cert-check domain.name
# Example:
# cert-check www.google.com
function cert-check() {
yes QUIT | openssl s_client -showcerts -servername $1 -connect $1:443 > /tmp/$1.pem && openssl x509 -inform PEM -in /tmp/$1.pem -text -out certdata | grep -i 'not after'
}
View termux-init.md

Thing to install for Termux

pkg update
pkg install -y \
    bash \
    bash-completion \
    git \
    vim \
    openssh \
@ralavay
ralavay / https-localhost.md
Created Jun 9, 2018
Run local development as HTTPS to handle Facebook app login enforce HTTPS
View https-localhost.md

Facebook enforces to use HTTPS for Facebook Login so we can't you http://localhost:port in local anymore.

We will just get this message

Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://

How to run your local development with HTTPS

View change_ubuntu_hostname.sh
#!/bin/bash
#
# Change hostname for Ubuntu host
OLD_NAME=$(hostname)
echo "- Current hostname is: $OLD_NAME"
read -p "- Please input new hostname: " NEW_NAME
update_ect_hostname() {
sudo hostname $NEW_NAME
@ralavay
ralavay / vim-nginx-conf-highlight.sh
Last active Jan 15, 2020
Enable syntax highlight for Nginx conf file in Vim
View vim-nginx-conf-highlight.sh
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF
@ralavay
ralavay / ls.md
Last active Aug 31, 2015
ls useful stuff
View ls.md
  1. List only dirs
ls -ld */.
  1. List only files
ls -p | grep -v /
View remove-mac-os-adware.sh
#!/usr/bin/env bash
#
# Stop pop-up adware in MAC OS
# https://support.apple.com/en-us/HT203987
# http://www.thesafemac.com/arg-identification/
# Allow to loop through path with spaces
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
@ralavay
ralavay / bash_aliases
Created Mar 29, 2014
bash_aliases for Ubuntu
View bash_aliases
# Aliases
# Copy this file to ~/.bash_aliases
alias update='sudo apt-get update'
alias upgrade='sudo apt-get upgrade -y'
alias up='sudo apt-get update && sudo apt-get upgrade -y'
alias dist-upgrade='sudo apt-get dist-upgrade -y'
alias inst='sudo apt-get install'
alias ins='sudo apt-get install --no-install-recommends'
alias remove='sudo apt-get remove --purge'
@ralavay
ralavay / sshfs_ubuntu.sh
Last active Aug 29, 2015
Install SSHFS in Ubuntu to mount remote folder to local
View sshfs_ubuntu.sh
#!/bin/bash
#
# Install SSHFS to mount remote folder to local folder -> edit code with Sublime for example
# Install sshfs
sudo apt-get install sshfs -y
sudo modprobe fuse
# Get your username
YOUR_USER_NAME=$(whoami)
You can’t perform that action at this time.