Skip to content

Instantly share code, notes, and snippets.

@efenfauzi
efenfauzi / haproxy.cfg
Last active August 2, 2024 06:40
haproxy + traefik docker get real ip from options xforwardedfor
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
@efenfauzi
efenfauzi / haproxy.cfg
Last active February 15, 2024 13:37
Haproxy config in front of letsencrypt traefik docker
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
@efenfauzi
efenfauzi / default.vcl_PREFACE.md
Created July 24, 2023 14:44 — forked from tejastank/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done for Joomla & WordPress). If your CMS provides a way to add these two requirements, then you can use this configurati

<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
@efenfauzi
efenfauzi / daemon.json
Created May 31, 2021 04:25
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,

unzip

for i in *.zip; do 
   unzip -o "$i" -d "${i%%.zip}"; 
done

unrar

1.install unrar

MP4Box -split amountOfSeconds path/to/file
MP4Box -splits amountOfSizeFile path/to/file
@efenfauzi
efenfauzi / ffmpeg.md
Created August 10, 2020 16:00 — forked from dvlden/ffmpeg.md
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@efenfauzi
efenfauzi / aiocron-test-2function.py
Created July 17, 2020 06:49
2 function task in asyncio
import asyncio
async def function1(delay):
await asyncio.sleep(delay)
print ("Function 1 Task")
async def function2(delay):
await asyncio.sleep(delay)
print ("Function 2 Task")
@efenfauzi
efenfauzi / aiocron-test.py
Last active July 17, 2020 05:54
test async with cron
# from https://github.com/gawel/aiocron
import aiocron
import asyncio
# this cron execute every 1minute
@aiocron.crontab('*/1 * * * *')
async def func1():
print ('Run Function 1')