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
@darmawan01
darmawan01 / postgres.go
Last active May 16, 2020 14:41
Setup postgres For Go
package db
import "github.com/jackc/pgx"
// InitPostgres func
func InitPostgres() (dbConnPool *pgx.ConnPool) {
conf := getConfig()
var err error
pgxConf := &pgx.ConnConfig{
@darmawan01
darmawan01 / README.md
Created May 18, 2020 15:09
Mysql Command

Backup:

mysqldump --column-statistics=0 --set-gtid-purged=OFF -h<Host> -u<User> -p<Password> <db_name> > backup.sql

Restore:

mysql -u<User> -p<Password> <dest_db> < backup.sql
@darmawan01
darmawan01 / hmm.dart
Last active September 28, 2020 05:50
Check the top of page with scroll controller
```
if (_scrollController.offset <=
_scrollController.position.minScrollExtent &&
!_scrollController.position.outOfRange) {
# Code here
}
```
@darmawan01
darmawan01 / err.MD
Created October 1, 2020 03:51
Error creating overlay mount to /var/lib/docker/overlay2

Error:

Error creating overlay mount to /var/lib/docker/overlay2/9ed4841a2d4212795c1cce322e90a058a38602aabe498d944e31f7b902c31313/merged: invalid argument

fix wrong driver

echo '{ "storage-driver": "devicemapper" }' | sudo tee /etc/docker/daemon.json

@darmawan01
darmawan01 / Proto.MD
Created February 15, 2021 07:09
Proto notes

Generate From Proto

docker run -v pwd:/gen -v pwd/api:/api grpc/go protoc -I /api/ /api/gerbang.proto --go_out=plugins=grpc:/gen

@darmawan01
darmawan01 / launch.json
Created April 30, 2021 03:02
Launch multi devices on mobile debugging
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// Use `flutter devices` to get your devices id
"version": "0.2.0",
"configurations": [
{
"name": "appname",
@darmawan01
darmawan01 / launch.json
Created April 30, 2021 03:03
Launch multiple devices on android debugging
{
"version": "0.2.0",
"configurations": [
{
"name": "appname",
"request": "launch",
"type": "dart"
},
{
"name": "Android",
@darmawan01
darmawan01 / CustomImageCache.dart
Last active April 5, 2024 16:07
Custom Image Provider To Cache Image bytes type
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
class CacheMemoryImageProvider extends ImageProvider<CacheMemoryImageProvider> {
final String tag; //the cache id use to get cache
final Uint8List img; //the bytes of image to cache
CacheMemoryImageProvider(this.tag, this.img);
@darmawan01
darmawan01 / date_formats.dart
Created June 23, 2021 12:50
Flutter Date Helpers
import 'package:intl/intl.dart';
/// An utility calss that manages specific formats.
class DateFormats {
/// The [DateFormat] 'yyyy-MM-dd HH:mm:ss'.
static final fullDateFormat = new DateFormat('yyyy-MM-dd HH:mm:ss');
/// The [DateFormat] 'yyyy/MM/dd'.
static final onlyDayDateFormat = new DateFormat('yyyy/MM/dd');
@darmawan01
darmawan01 / note.MD
Last active June 25, 2021 07:04
SCP or RSYNC over Jumphost

SCP Over :

scp "ProxyCommand ssh <jumphost> -W %h:%p" <src> <dest>

RSYNC Over :

rsync -azv -P -e 'ssh -o "ProxyCommand ssh -A <jumphost> -W %h:%p"' <src> <dest>