Skip to content

Instantly share code, notes, and snippets.

View rizalgowandy's full-sized avatar
🎧
Focusing

Rizal Widyarta Gowandy rizalgowandy

🎧
Focusing
View GitHub Profile
@rizalgowandy
rizalgowandy / ducky.md
Last active July 25, 2023 07:18 — forked from schmich/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2

To use media keys on the Ducky One 2, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@rizalgowandy
rizalgowandy / pre-commit
Last active October 19, 2018 04:00
Git Pre-commit Hook for Golang Developer
#!/bin/sh
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
# This script does not handle file names that contain spaces.
# List all unformatted files
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
@rizalgowandy
rizalgowandy / pre-push
Last active August 11, 2021 21:09
Git Pre-push Hook for Golang Developer
WARNING THIS IS ON DEVELOPMENT, DO NOT USE THIS
WARNING THIS IS ON DEVELOPMENT, DO NOT USE THIS
WARNING THIS IS ON DEVELOPMENT, DO NOT USE THIS
#!/bin/bash
# git test pre-push hook
#
# To use, store as .git/hooks/pre-push inside your repository and make sure
# it has execute permissions.
#
@rizalgowandy
rizalgowandy / converter.go
Created November 7, 2018 06:32
Convert to Indonesia Rupiah
func ToIndonesianNumber(value int64) string {
sign := ""
if value < 0 {
sign = "-"
value = 0 - value
}
parts := []string{"", "", "", "", "", "", ""}
j := len(parts) - 1
@rizalgowandy
rizalgowandy / gist:caaee9664ff5bc1259a5c2af1c93b1bb
Created February 18, 2019 05:37 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@rizalgowandy
rizalgowandy / multipart_upload.go
Created April 16, 2019 09:02 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@rizalgowandy
rizalgowandy / mock_generator.sh
Created June 17, 2019 02:48
Automatic Go Mock Generator
#!/usr/bin/env bash
# mockgen will generates mock interface
# for your changes from master branch into mock directory
# Example :
# /src/order.go
#
# your mock will generated to
#
# /mocks/mock_src/order_mock.go
@rizalgowandy
rizalgowandy / gzip.go
Created June 29, 2019 07:00 — forked from CJEnright/gzip.go
Idiomatic golang net/http gzip transparent compression, an updated version of https://gist.github.com/bryfry/09a650eb8aac0fb76c24
package main
import (
"net/http"
"compress/gzip"
"io/ioutil"
"strings"
"sync"
"io"
)
@rizalgowandy
rizalgowandy / ssh.md
Created December 15, 2019 08:40 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@rizalgowandy
rizalgowandy / tutorial.sh
Last active December 28, 2019 13:49 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"