Skip to content

Instantly share code, notes, and snippets.

View zulhfreelancer's full-sized avatar

Zulhilmi Zainudin zulhfreelancer

View GitHub Profile
@zulhfreelancer
zulhfreelancer / k8s-ephemeral.sh
Created October 8, 2021 04:44
Kubernetes ephemeral pod (like `docker run --rm`)
kubectl run debug --rm -i --tty --restart=Never --image=alpine --namespace=default -- /bin/sh
@zulhfreelancer
zulhfreelancer / ip-address-websites.md
Created August 6, 2021 06:51
List of websites that can return IP address
@zulhfreelancer
zulhfreelancer / local-ruby-gem.md
Last active April 1, 2025 04:28
How to use a local Ruby gem in Rails project?

Situation

You are working on a Rails app that uses a gem named abc. This gem is hosted on RubyGems and the source code of the gem is available at https://github.com/your-username/abc.

You created a new branch locally for your gem (new-feature). You wanted to modify the gem and load it directly to your local Rails app. And, you don't want to push the gem changes to GitHub and publish the gem to RubyGems just yet.

You want all the changes that you made in your local gem directory get reflected immediately in your local Rails app without requiring you to run gem build and gem install command in the gem's local directory.

Steps

@zulhfreelancer
zulhfreelancer / _flash.html.erb
Last active May 13, 2023 15:00
How to add link inside Rails flash message? Tested with Rails 6.
<!--
* File: app/views/shared/_flash.html.erb
* Note: the `html_safe` is important here
-->
<% flash.each do |type, msg| %>
<div class="alert alert-info">
<%= msg.html_safe %>
</div>
<% end %>
@zulhfreelancer
zulhfreelancer / gps-glonass-golang.go
Last active June 12, 2021 16:38
Get latitude and longitude from Glonass GPS USB stick (U-blox7) using Golang
package main
import (
"fmt"
"github.com/stratoberry/go-gpsd"
"time"
)
func main() {
var gps *gpsd.Session
@zulhfreelancer
zulhfreelancer / README.md
Last active July 14, 2021 15:56
How to install an older or specific version of Homebrew tap package?

Problem

When using Homebrew Tap, it's quite hard to install an older or specific version of Homebrew package.

It took me awhile to run some tests before I found the solution (see below).

If you are facing the same problem, you can use my script below to solve the problem.

Solution

@zulhfreelancer
zulhfreelancer / fix-multipass-starting-on-mac.md
Last active August 21, 2023 21:04
How to fix Multipass stuck at "Starting" state on Mac OSX?
# Step 1: see the status of VMs
$ multipass ls
Name   State          IPv4           Image
vm1    Stopped        --             Ubuntu 20.04 LTS <-- this one is OK, stopped in previous command
vm2    Starting       --             Ubuntu 20.04 LTS <-- this one is not OK, why it's stuck?



# Step 2: apply the fix
@zulhfreelancer
zulhfreelancer / pbcopy-on-remote-server.md
Created May 24, 2021 05:02
How to use `pbcopy` on Linux server when using SSH?

If you are using iTerm2 on Mac OSX and trying to have pbcopy experience when using Linux server (over SSH), try this remote-pbcopy-iterm2 tool.

@zulhfreelancer
zulhfreelancer / kubevirt-virsh.md
Created April 26, 2021 04:43
How to use Virsh command to interact with Kubevirt VMs running in Kubernetes cluster?
$ kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
virt-launcher-vm-4sd8h   1/1     Running   0          2d13h



$ kubectl exec -it virt-launcher-vm-4sd8h -- bash
bash-5.0# virsh list
 Id Name State
@zulhfreelancer
zulhfreelancer / regex.md
Last active March 23, 2021 06:54
Regex to find WIP Golang function comments in VS Code