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 / docker-compose.yml
Last active August 3, 2022 09:50
HAPI FHIR Server Docker Compose
version: "3"
networks:
fhir-server:
driver: bridge
services:
fhir:
container_name: fhir-server
image: hapiproject/hapi:v5.3.0
@darmawan01
darmawan01 / helper.ts
Created August 2, 2022 01:59
Duplicate file with replacer content using typescript
export const createACopy = (
sourceFile: string,
destFile: string,
matchers: string[],
replacer: string[],
) => {
// Import the filesystem module
const filePath = path.join(`${process.cwd()}/path/`, sourceFile);
let programSource = readFileSync(filePath).toString();
@darmawan01
darmawan01 / notes.MD
Last active July 1, 2022 07:13
Setup Server

DEPLOYMENT STEP

  1. Add user -> sudo adduser <new-user>
  2. Add new user to root group usermod -aG sudo <new-user>
  3. su <new-user> -> switch to new user
  4. Run <new-user> as root with sudo visudo
  5. Add new line <new-user> ALL=(ALL) NOPASSWD:ALL and save it
  6. exit the user and try su <new-user> again
  7. Update and upgrade OS apt-get update && sudo apt-get upgrade
  8. apt install vim -> installing vim
@darmawan01
darmawan01 / README.md
Last active April 6, 2022 07:18
Golang logger flags
log.SetFlags(log.LstdFlags | log.Lshortfile)
@darmawan01
darmawan01 / runner.sh
Last active February 24, 2022 10:36
Run Our Own Gitlab Runner
#!/bin/bash
# See at link below for update
# https://gist.github.com/darmawan01/b600707ba10d1c2f4267717c69904336
if [ "$1" = "init" ]; then
docker run -d --name gitlab-runner \
--restart always \
--privileged \
-v $(pwd):/etc/gitlab-runner \
@darmawan01
darmawan01 / PrivateRoute.tsx
Created January 14, 2022 22:33
Typescript Private Route React Router
import React from 'react';
import {
Navigate, Route, RouteProps
} from 'react-router-dom';
interface PrivateRouteProps extends RouteProps {
// tslint:disable-next-line:no-any
component: any;
isAuthenticated: boolean;
}
@darmawan01
darmawan01 / omama.MD
Created December 23, 2021 11:57
Grep and Sed to Replace some string in Mac OS
egrep -rl 'kecamatan_id' seeders/* | xargs -I@ sed -i '' 's/kecamatan_id/subdistrict_id/g' @
@darmawan01
darmawan01 / omama.dart
Created December 8, 2021 09:35
Flutter Text Field with currency format
TextInputFormatter.withFunction((oldValue, newValue) {
if (newValue.selection.baseOffset == 0) {
return newValue;
}
double value = double.parse(newValue.text);
final formatter = NumberFormat.simpleCurrency(
locale: "nok",
);
@darmawan01
darmawan01 / notes.MD
Created September 14, 2021 02:28
Protobuf & GRPC

Golang generate protoc

  • With Docker
docker run -v `pwd`:/gen -v `pwd`:/api grpc/go protoc -I /api/ /api/api.proto --go_out=plugins=grpc:/gen
@darmawan01
darmawan01 / omama.MD
Created September 9, 2021 22:20
Error Create Overlay Mount Docker on CoreOS
# fix wrong driver
echo '{ "storage-driver": "devicemapper" }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service

# fix aliyun buggy selinux
sudo sed -i 's/SELINUXTYPE=mcs/SELINUXTYPE=targeted/' /etc/selinux/config

Ref: coreos/bugs#2340 (comment)