Skip to content

Instantly share code, notes, and snippets.

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

Yoga Hanggara yohangdev

🏠
Working from home
View GitHub Profile
@yohangdev
yohangdev / server.conf
Created May 5, 2017 00:20
OpenVPN Config, Port 443, UDP, LDAP, Routing, No Redirect Gateway
port 443
proto udp
#port-share 10.1.14.55 4443
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
@yohangdev
yohangdev / php.ini
Last active February 13, 2026 11:07
PHP FPM Hardening php.ini
upload_tmp_dir = "/var/php_tmp"
session.save_path = "/var/lib/php/sessions"
open_basedir = "/var/www:/var/lib/php/sessions:/var/php_tmp"
file_uploads = Off
allow_url_fopen = Off
disable_functions = "php_uname, getmyuid, getmypid, passthru, leak, listen, diskfreespace, tmpfile, link, ignore_user_abord, shell_exec, dl, set_time_limit, exec, system, highlight_file, source, show_source, fpaththru, virtual, posix_ctermid, posix_getcwd, posix_getegid, posix_geteuid, posix_getgid, posix_getgrgid, posix_getgrnam, posix_getgroups, posix_getlogin, posix_getpgid, posix_getpgrp, posix_getpid, posix, _getppid, posix_getpwnam, posix_getpwuid, posix_getrlimit, posix_getsid, posix_getuid, posix_isatty, posix_kill, posix_mkfifo, posix_setegid, posix_seteuid, posix_setgid, posix_setpgid, posix_setsid, posix_setuid, posix_times, posix_ttyname, posix_uname, proc_open, proc_close, proc_get_status, proc_nice, proc_terminate, phpinfo"
expose_php = Off
error_reporting = E_ALL
display_error = Off
display_startup_errors = Off
@yohangdev
yohangdev / README.md
Created February 25, 2025 17:39 — forked from marshyon/README.md
Golang Echo web server VueJS App in history mode and Go web services

Golang Echo web server VueJS App in history mode and Go web services

In an previous gist a VueJS application was served using a plain net/http server.

This version uses the Echo web server framework and adds the diversion of any '404' (page not found) errors to the index.html page of the VueJS application. With this enabled, any VueJS routed URLs that are 'bookmarked' by a user will be sent to the index.html of the VueJS application. This way 'routing' is passed to the single page app running on the clients browser.

@yohangdev
yohangdev / logging.php
Created November 11, 2020 03:50
Laravel Logging Stdout
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
@yohangdev
yohangdev / pre-commit
Created September 2, 2015 07:27
Git Pre-Commit Hooks Write Commit Hash to File
#!/usr/bin/env bash
set -e
#=== 'prev-commit' solution by o_O Tync
#commit_hash=$(git rev-parse --verify HEAD)
commit=$(git log -1 --pretty="%H%n%ci") # hash \n date
commit_hash=$(echo "$commit" | head -1)
commit_date=$(echo "$commit" | head -2 | tail -1) # 2010-12-28 05:16:23 +0300
branch_name=$(git symbolic-ref -q HEAD) # http://stackoverflow.com/questions/1593051/#1593487
@yohangdev
yohangdev / etc-network-interfaces
Last active May 27, 2024 07:15
Proxmox single IP public with bridge/local network (NAT)
# source: https://raymii.org/s/tutorials/Proxmox_VE_One_Public_IP.html
iface eth0 inet manual
iface eth1 inet manual
auto vmbr0
iface vmbr0 inet static
address 163.172.103.199
netmask 255.255.255.0
@yohangdev
yohangdev / aws-s3-bulk-metadata.sh
Created February 19, 2024 16:40
AWS S3 Bulk Update Metadata using Command Line (CLI)
aws s3 cp \
s3://bucket/path/ \
s3://bucket/path/ \
--exclude '*' \
--include '*.png' \
--no-guess-mime-type \
--content-type="image/png" \
--metadata-directive="REPLACE" \
--recursive
@yohangdev
yohangdev / xdebug-mac.md
Created October 14, 2023 11:11 — forked from ankurk91/xdebug-mac.md
php xDebug v3 on Ubuntu/Mac and phpStorm

🪲 Install and Configure xDebug v3 on MacOS for PhpStorm 🐘

  • Assuming that you have already installed php and apache via Homebrew

  • Install xDebug php extension

pecl channel-update pecl.php.net
pecl clear-cache

pecl install xdebug
@yohangdev
yohangdev / Dockerfile
Created May 7, 2021 16:54
Dockerfile PHP 8 & Newrelic Agent
FROM alpine:3.13
LABEL Maintainer="Yoga Hanggara <yohang88@gmail.com>" \
Description="Lightweight Laravel app container with Nginx 1.18 & PHP-FPM 8 based on Alpine Linux."
ARG PHP_VERSION="8.0.2-r0"
# Install packages
RUN apk --no-cache add php8=${PHP_VERSION} php8-fpm php8-opcache php8-openssl php8-curl php8-phar php8-session \
php8-fileinfo php8-pdo php8-pdo_mysql php8-mysqli php8-mbstring php8-dom \
@yohangdev
yohangdev / postgresql_id.sql
Last active January 17, 2023 07:19
PostgreSQL Better ID & UUID Generator
create schema shard_1;
create sequence shard_1.global_id_sequence;
CREATE OR REPLACE FUNCTION shard_1.id_generator(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
-- the id of this DB shard, must be set for each
-- schema shard you have - you could pass this as a parameter too