Skip to content

Instantly share code, notes, and snippets.

View darmawan01's full-sized avatar
🏠
Working from home

Dz darmawan01

🏠
Working from home
  • Indonesia
View GitHub Profile
package main
import (
"fmt"
"strings"
)
func main() {
// Our Test
args := "1 1 0 0 2 1"
@darmawan01
darmawan01 / fresh.bat
Last active February 6, 2020 09:08
Issues: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
Solved:
1. Login to redis client
2. Execute config set stop-writes-on-bgsave-error no
3. Execute FLUSHALL (Delete all keys from all Redis databases)
4. Execute config set stop-writes-on-bgsave-error yes
@darmawan01
darmawan01 / README.md
Last active April 6, 2022 07:18
Golang logger flags
log.SetFlags(log.LstdFlags | log.Lshortfile)
@darmawan01
darmawan01 / date.js
Created April 29, 2020 02:35
Formating datetime
export const getDateFromTimeStamp = (timestamp) => {
return date.format(new Date(timestamp), 'ddd, DD MMMM YYYY', { locale: dateLocaleId })
}
@darmawan01
darmawan01 / cmd.MD
Created April 30, 2020 05:20
Linux great command

Check listening port

lsof -i -P -n | grep LISTEN
@darmawan01
darmawan01 / omama.js
Created May 5, 2020 03:48
Create file download link
```
download = (data, name) => {
const fileURL = window.URL.createObjectURL(data);
const tempLink = document.createElement('a');
tempLink.href = fileURL;
tempLink.target = '_blank';
tempLink.setAttribute('download', name);
tempLink.click();
}
```
@darmawan01
darmawan01 / multipart_upload.go
Created May 5, 2020 06:04 — 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"
@darmawan01
darmawan01 / timezone.MD
Created May 11, 2020 09:27
Change Container Time Zone

None-alpine:

echo <TIMEZONE> > /etc/timezone && ln -sf /usr/share/zoneinfo/<TIMEZONE> /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
// Before
Current default time zone: 'Etc/UTC'
Local time is now: Mon May 11 08:21:58 UTC 2020.
@darmawan01
darmawan01 / mysql-gorm.go
Last active May 16, 2020 14:10
Setup Mysql Connection With Gorm
package db
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
// InitMysql func
@darmawan01
darmawan01 / postgres-gorm.go
Created May 16, 2020 14:09
Setup Postgres With Gorm
package db
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
// InitPostgres func