Skip to content

Instantly share code, notes, and snippets.

View zulhfreelancer's full-sized avatar

Zulhilmi Zainudin zulhfreelancer

View GitHub Profile
@zulhfreelancer
zulhfreelancer / view-yaml-gz-k8s-secret.md
Created January 12, 2023 03:02
How to view the content of *.yaml.gz file stored in Kubernetes secret?

How to view the content of *.yaml.gz file stored in Kubernetes secret?

$ kubectl -n <NAMESPACE> get secret <SECRET> -o json | jq -r '.data."prometheus.yaml.gz"' | base64 -d | gunzip
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active August 22, 2026 03:28
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@zulhfreelancer
zulhfreelancer / how-to-install-promtool.md
Created April 4, 2024 04:07
How to install promtool by Prometheus?

How to install promtool by Prometheus?

# Fetch latest version
TAG=$(curl -s https://api.github.com/repos/prometheus/prometheus/releases | jq -r '.[] | .tag_name' | head -n 1)
echo $TAG

# Remove the `v` prefix
VERSION=$(echo $TAG | sed 's/v//')
echo $VERSION
@zulhfreelancer
zulhfreelancer / install-docker.md
Last active August 6, 2026 05:44
Install Docker oneliner script

Just install Docker

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Install Docker and Rancher Server

$ curl -fsSL get.docker.com -o get-docker.sh &amp;&amp; sh get-docker.sh &amp;&amp; sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

@zulhfreelancer
zulhfreelancer / first_commit_in_branch.md
Created December 2, 2016 04:11
How to find the first commit in a Git branch?
$ git log <source_branch>..<feature_branch> --oneline | tail -1

Reference

@zulhfreelancer
zulhfreelancer / show-all-docker-build-logs.md
Created June 1, 2023 08:25
How to show all `docker build` logs?

How to show all docker build logs?

docker build -t YOUR-USER-NAME/YOUR-REPO:<YOUR-IMAGE-TAG> --no-cache --progress=plain .
@zulhfreelancer
zulhfreelancer / measure-response-time-curl.md
Last active March 17, 2026 16:00
How to measure response time using `curl`?

How to measure response time using curl?

Command:

curl -kv -w '\n* Response time: %{time_total}s\n' <IP_OR_URL>

Example:

@zulhfreelancer
zulhfreelancer / malaysia_postcode_list.json
Last active January 20, 2026 04:30
Malaysia Postcode List By State (JSON)
{
"prepared_by": "Zulhilmi Zainudin",
"last_update": "21 June 2016",
"data": [
{
"state": "Selangor",
"codes": [
"40000",
"40100",
@zulhfreelancer
zulhfreelancer / exclude_regex.md
Last active October 24, 2025 05:59
Chrome console: How to filter exclude certain logs?

Use this:

^((?![INSERT YOUR WORD THAT YOU WANT TO EXCLUDE HERE]).)*$

Don't forget to check the Regex checkbox!

Example:

I'm excluding logs that contains Pusher words here. So, this is what I put inside the filter box: ^((?!pusher).)*$

@zulhfreelancer
zulhfreelancer / nginx_port_8080_to_80.md
Last active October 17, 2025 16:34
How to change Nginx port 8080 to 80
  1. ssh root@IP_ADDRESS
  2. nano /etc/nginx/sites-enabled/default
  3. add this at the bottom of the file:
server {
        listen 80;
        listen [::]:80;

        server_name YOUR_DOMAIN_NAME_HERE;