Skip to content

Instantly share code, notes, and snippets.

View hadihammurabi's full-sized avatar
😎
Let's code with me!

Hadi Hidayat Hammurabi hadihammurabi

😎
Let's code with me!
View GitHub Profile
@hadihammurabi
hadihammurabi / casbin.md
Last active February 3, 2021 10:13
Casbin With Golang

Casbin

Model

  • request_definition pola parameter pengecekan otorisasi.
  • policy_definition pola otorisasi yang terdaftar.
  • role_definition pola role atau group yang terdaftar.
  • policy_effect kondisi untuk menentukan diizinkan atau tidak.
  • matchers kondisi yang digunakan untuk memenuhi kondisi pada policy effect.
@hadihammurabi
hadihammurabi / Pythonic_Way.md
Created March 5, 2020 13:50 — forked from ypraw/Pythonic_Way.md
Rangkuman Kulgram pythonic way , telegram group taman kode-kode https://t.me/tamankodekode

Introduce Python : Pythonic way, Guide of life to become the pythonist

Prasyarat

  • Installed Python 3.* above (my recomendations 3.7), you can download here

  • Text editor or IDE, everything you like it. an example vim, micro, nano, visual studio code, pycharm, Netbeans etc. (maybe i use jupyter notebook XD)

  • a cup of coffe and enjoy :D

@hadihammurabi
hadihammurabi / database.sql
Last active September 19, 2019 04:53
PostgreSQL Sharding with Declarative Partition Example
CREATE TYPE jeniskelamin AS ENUM('l', 'p');
CREATE TABLE users (
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
jk jeniskelamin NOT NULL
) PARTITION BY LIST(jk);
CREATE TABLE users_l PARTITION OF users FOR VALUES IN('l');
CREATE TABLE users_p PARTITION OF users FOR VALUES IN('p');

Linux Suspend Commands

Suspend to RAM

# echo mem > /sys/power/state

@hadihammurabi
hadihammurabi / README.md
Created August 11, 2019 15:42
Tmux Cheat Sheet

Tmux Cheat Sheet

Session Sharing

Create session with socket file:

tmux -S /tmp/shareds new -s shared

Allow another user to access the socket file:

@hadihammurabi
hadihammurabi / etc-init.d-mongodb
Created July 23, 2019 19:37
OpenRC init file for MongoDB
#!/usr/bin/openrc-run
# MONGOHOME="/usr/local/mongodb"
CONFIGFILE="/etc/mongodb.conf"
DBPATH=`awk -F= '/^dbpath[ ]*=/{print $2}' "$CONFIGFILE" |sed -e 's/^[ ]*//'`
COMMAND="mongod"
OPT="--config $CONFIGFILE"
mongod=$COMMAND
PIDPATH="/var/run/mongodb/mongodb.pid"
@hadihammurabi
hadihammurabi / xrandr-multiscreen.sh
Last active July 23, 2019 09:02
Multiscreen control from CLI using XRandR
#!/bin/bash
# connect to screen using HDMI
xrandr --output HDMI-1 --mode 1360x768 --auto --above eDP-1
# disconnect
xrandr --output HDMI-1 --off
@hadihammurabi
hadihammurabi / npm-global-updater.sh
Last active July 15, 2019 03:15
Shell script to update all npm outdated global package
sudo npm i -g $(npm outdated -g --depth=0 --parseable | cut -d: -f2 | awk -F'\n' ' { printf "%s ", $1 } ')
@hadihammurabi
hadihammurabi / micro-frontend-stitching.html
Created July 10, 2019 16:22
Example for micro frontends stitching layer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Toko Online</title>
</head>
<body>
<div id="katalog"></div>