Skip to content

Instantly share code, notes, and snippets.

View diki-haryadi's full-sized avatar
๐ŸŽฏ
Focusing

Diki Haryadi diki-haryadi

๐ŸŽฏ
Focusing
View GitHub Profile
@diki-haryadi
diki-haryadi / mysql-server.md
Last active September 23, 2021 03:48
Install and Config Mysql on Ubuntu

$ sudo apt install default-mysql-server default-mysql-client

$ sudo cat /etc/mysql/debian.cnf

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = JRptVM1k9l8SvIau
socket = /var/run/mysqld/mysqld.sock
@diki-haryadi
diki-haryadi / nullHandle.go
Created October 31, 2021 19:56 — forked from rsudip90/nullHandle.go
How I handled the null possible value in a sql database row in golang?
package main
import (
"database/sql"
"encoding/json"
"fmt"
"reflect"
"time"
"github.com/go-sql-driver/mysql"
@diki-haryadi
diki-haryadi / List Belajar
Created November 29, 2021 15:34
List Belajar
# Resource Belajar
- https://www.golangprograms.com/for-range-loops.html
- https://www.geeksforgeeks.org/fmt-printf-function-in-golang-with-examples/
- https://github.com/rakyll/gowiki/blob/master/GoUsers.md
- http://kokizzu.blogspot.com/2016/12/list-of-tech-migrations.html
- https://go.dev/tour/welcome/1
- https://play-with-go.dev/
- https://gobyexample.com/
- https://www.youtube.com/results?search_query=golang+tutorial&sp=EgIQAw%253D%253D
- https://gist.github.com/prologic/5f6afe9c1b98016ca278f4d507e65510
@diki-haryadi
diki-haryadi / Handling Null SQL in Golang
Created December 15, 2021 10:59
Handling Null SQL in Golang
```
package helper
import (
"database/sql"
"encoding/json"
"fmt"
"reflect"
"time"
@diki-haryadi
diki-haryadi / Reverse Array
Last active December 18, 2021 03:56
Reverse Array
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"errors"
"fmt"
"io"
# GS Appscript
```
function doGet(e) {
Logger.log(e);
var op = e.parameter.action;
var ss = SpreadsheetApp.open(DriveApp.getFileById("YOUR_SPREADSHEET_ID"));
var sn = "YOUR_SHEET_NAME";
var sheet = ss.getSheetByName(sn);
# create script
nano create-shortcut.sh
```
#!/bin/bash
echo "Enter the path to the logo image:"
read logo_path
echo "Enter the path to the executable application:"
read executable_path
@diki-haryadi
diki-haryadi / ๐“๐ข๐ ๐ก๐ญ-๐‚๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐ -vs-๐‹๐จ๐จ๐ฌ๐ž-๐‚๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐ .md
Created December 31, 2024 22:57
Mau liat contoh ๐“๐ข๐ ๐ก๐ญ ๐‚๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐  vs ๐‹๐จ๐จ๐ฌ๐ž ๐‚๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐  pake ๐†๐จ๐ฅ๐š๐ง๐ ?

๐“๐ข๐ ๐ก๐ญ ๐‚๐จ๐ฎ๐ฉ๐ฅ๐ข๐ง๐ 

Di contoh ini, UserService langsung terikat sama DataSource tertentu. Kalo kita mau ganti dari PostgreSQL ke MySQL misalnya, kita harus rombak banyak hal di UserService.

package main

import "fmt"

// DataSource contohnya "koneksi" ke DB tertentu
type DataSource struct {
{
"data": {
"microdrama_hc_id": 1
},
"status": {
"code": 0,
"message_client": "success",
"message_server": "success"
},
"meta": {