Skip to content

Instantly share code, notes, and snippets.

Working from home

Darmawan Zulkifli darmawan01

Working from home
Block or report user

Report or block darmawan01

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View challenge-7.js
class Clock {
currentPosition(code) {
// Split the code to array of char
const codes = code.split('')
// Initiate some variables
let isMove = false,
position = 60,
currentCode = '';
View challenge-6.js
class Brankas {
unlock(key) {
const keys = key.split('')
let turned = 0,
lastPosition = 0,
isForward = true;
for (let i in keys) {
// Key less than last position and is forward, turnaround backward
// Or key greater than last position and is turnaround before, turned again forward
darmawan01 /
Last active Oct 5, 2019
Docker && Docker Compose instalations
# docker preparation until install in linux
# docker
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
darmawan01 / settings.json
Last active Nov 12, 2019
Vscode - my custom vscode settings
View settings.json
"workbench.startupEditor": "none",
"window.zoomLevel": -2,
"editor.multiCursorModifier": "ctrlCmd",
"javascript.updateImportsOnFileMove.enabled": "always",
"terminal.integrated.rendererType": "dom",
"editor.minimap.enabled": false,
"workbench.panel.defaultLocation": "right",
"workbench.editor.tabCloseButton": "right",
"terminal.integrated.cursorStyle": "underline",
darmawan01 /
Last active Nov 25, 2019
Mostly Used Command - Postgres

Copy some file to docker container

docker cp <file_to_copy> <container_name>:<dir_destination_in_docker>

Restore pg sql dump to docker container

docker container exec <container_db> psql -U <db_user> <db_name> -f <backup>.sql

Backup pg sql data only

docker container exec -it <container_db> pg_dump --data-only -U <db_user> <db_name> > <backup>.sql

Check/List pg enum

darmawan01 / dokcer-compose.yml
Created Sep 5, 2019
Simple docker compose for static web
View dokcer-compose.yml
version "3"
image: nginx:1.15.8-alpine
restart: always
working_dir: /usr/share/nginx/html
- "2000:80"
- ./proxy.conf:/etc/nginx/conf.d/default.conf
darmawan01 / nginx.conf
Created Sep 5, 2019
Static web ngixn conf
View nginx.conf
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html;
location ~ ^/(css|js)/ {
expires max;


docker exec -t oa-monolithic_db_1 pg_dumpall -c -U oa > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
View redisPubSubExample.go
package main
import (
uuid ""
darmawan01 / DateExtension.kt
Created Mar 2, 2019 — forked from maiconhellmann/DateExtension.kt
Date extensions wrote in Kotlin
View DateExtension.kt
import java.text.SimpleDateFormat
import java.util.*
* Pattern: yyyy-MM-dd HH:mm:ss
fun Date.formatToServerDateTimeDefaults(): String{
val sdf= SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
return sdf.format(this)
You can’t perform that action at this time.