Skip to content

Instantly share code, notes, and snippets.

View kylewin's full-sized avatar
🎯
Focusing

Kyle Nguyen kylewin

🎯
Focusing
View GitHub Profile
@kylewin
kylewin / grafana-kibana-nginx.md
Created May 11, 2024 10:05
Grafana and Kibana behind Nginx subdomain

Grafana

To access with http://domain.com/grafana:

/etc/nginx/sites-available/default:
...
location /grafana {
    rewrite  ^/grafana/(.*)  /$1 break;
    proxy_set_header Host $host;
    proxy_pass http://localhost:3000;
}
@kylewin
kylewin / self-signed-rootca.md
Last active May 12, 2024 03:51
Self-signed RootCA

RootCA installation

Generate a RootCA private key

openssl genrsa -out ca.key 2048

Generate a Cert from RootCA private key

openssl req -new -x509 -key ca.key -out ca.crt
@kylewin
kylewin / get-crypto-price.sh
Last active December 30, 2023 06:32
Get Crypto price
symbol=$(echo $1 | tr 'a-z' 'A-Z')
filter=".data.$symbol.name,.data.$symbol.quote.USD.price"
token=$(security find-generic-password -a "$USER" -s 'CMC_API_TOKEN' -w)
curl -s -H "X-CMC_PRO_API_KEY: $token" -H "Accept: application/json" -d "symbol=$symbol" "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest" -G | jq $filter | tee >(pbcopy)
@kylewin
kylewin / get-vn-sjc-gold-price.sh
Last active December 30, 2023 06:32
Get SJC Gold price
curl -s https://sjc.com.vn/giavang/textContent.php | rg -A2 10L | rg -o '.{0,6},000'
#curl -s https://sjc.com.vn/giavang/textContent.php | grep -A2 10L | grep -oP '.{0,6},000'