Skip to content

Instantly share code, notes, and snippets.

View dwinurhadia's full-sized avatar
🐳
Surfing the Land

Dwi Nurhadi dwinurhadia

🐳
Surfing the Land
View GitHub Profile
@dwinurhadia
dwinurhadia / ipset.service
Created November 20, 2023 07:21 — forked from meanevo/ipset.service
IPSet settings persistence
#
# reference: http://namsep.blogspot.com/2015/12/yad-centos-7-iptables-ipset-and-fail2ban.html
# reference: http://pkgs.fedoraproject.org/cgit/ipset.git/tree/ipset.service
# file location: /etc/systemd/system/ipset.service
#
# systemctl enable ipset.service
# mkdir /etc/ipset
# touch /etc/ipset/ipset
# ...do something with ipset...
# ipset save > /etc/ipset/ipset
@dwinurhadia
dwinurhadia / pf.conf
Created November 14, 2023 13:03 — forked from fcayci/pf.conf
Sample FreeBSD pf firewall configuration
# /etc/pf.conf
##########################################
# MACROS
##########################################
WANIF = "vlan1337"
LANIF = "en0"
VPNIF = "{tun0, tun1}"
@dwinurhadia
dwinurhadia / dump.sh
Created October 24, 2023 07:04 — forked from andsens/dump.sh
Backup all MySQL databases into separate files
#!/bin/sh
## backup each mysql db into a different file, rather than one big file
## as with --all-databases. This will make restores easier.
## To backup a single database simply add the db name as a parameter (or multiple dbs)
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is
## Create the user and directories
# mkdir -p /var/backups/mysql/databases
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup
## Remember to make the script executable, and unreadable by others
@dwinurhadia
dwinurhadia / codeiginter-server-config.md
Created October 9, 2023 01:51 — forked from yidas/codeiginter-server-config.md
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@dwinurhadia
dwinurhadia / jail.local
Created September 20, 2023 07:16 — forked from luiseok/jail.local
Fail2ban MongoDB filter.d configuration file
#
# File Path : /etc/fail2ban/jail.local
#
# Please modify the port and logpath that you configured.
#
[mongo-auth]
enabled = true
filter = mongo-auth
@dwinurhadia
dwinurhadia / snat_dnat_advantech.md
Created April 4, 2023 09:36 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot).

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

How to test 'safely'

When we play with iptables aka firewall we might end up in situation, where we execute rule, which has unforseen impact - lock yourself out. Recovering from this situation is necessity.

How to:

  • Enable reboot via SMS.
  • Test all commands in shell first before putting them into Start-up script. This way the command will be wiped out, when unit is rebooted.

masquarade all outgoing packets to be WLAN0 IP

@dwinurhadia
dwinurhadia / sysctl.conf
Created April 3, 2023 07:13 — forked from yegorg/sysctl.conf
ubuntu sysctl performance tuning
# Kernel sysctl configuration file for Linux
#
# Version 1.12 - 2015-09-30
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@dwinurhadia
dwinurhadia / nginx-webp.conf
Last active January 10, 2023 13:03 — forked from uhop/nginx-webp-sample.conf
Serving WEBP with nginx conditionally.
user www-data;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;

Mastodon Docker Setup

Setting up

Clone Mastodon's repository.

# Clone mastodon to ~/live directory
git clone https://github.com/tootsuite/mastodon.git live
# Change directory to ~/live

cd ~/live

@dwinurhadia
dwinurhadia / nodejs-cicd-github-actions.md
Created December 5, 2022 07:55 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder