Skip to content

Instantly share code, notes, and snippets.

View guiwuff's full-sized avatar
💭
On the way

guiwuff guiwuff

💭
On the way
  • Jakarta
View GitHub Profile
@guiwuff
guiwuff / self-signed-ssl-certificate.md
Created August 22, 2024 11:02 — forked from lon-io/self-signed-ssl-certificate.md
Setup a self-signed SSL certificate with Nginx (server and browser)

1. Configure server: Nginx

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
@guiwuff
guiwuff / snat_dnat_advantech.md
Created August 21, 2024 16:32 — 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

@guiwuff
guiwuff / find-replace-text-in-vim.md
Created May 19, 2017 10:26
Find and Replace text in vim
@guiwuff
guiwuff / max-upload-size-wordpress.md
Last active May 5, 2017 10:13
Maximum Upload Size in Wordpress

Maximum Upload Size in Wordpress

Put or modify php.ini in your root wordpress installation directory (eg. public_html/)

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
@guiwuff
guiwuff / common-regex-pattern.md
Last active May 3, 2017 08:18
Common regex pattern for URL Redirection in Wordpress

Common regex pattern for URL Redirection in Wordpress

  • all : (.*)
    • eg: /category/category-name/(.*).html => /category/category-name/$1/
    • redirect /category/category-name/all-kind-of-name.html into /category/category-name/all-kind-of-name/
  • 2 digit month (01-12) and 4 digit year : ((0[1-9])|(1[0-2])) and (\d{4}) eg:/category-name/article-title-(\d{4})-((0[1-9])|(1[0-2]))/ => /category-name/article-title-$2-$1/
@guiwuff
guiwuff / custom-php-fpm-docker-image-from-a-container.md
Created May 1, 2017 11:49
Custom php-fpm Docker Image from a Container

Create Custom Docker Images for php-fpm with additional Modules

Make sure you have docker up and running.

Base Image php:5.6.30-fpm

Pull the official php-fpm 5.6 from docker registry, it will pull all of the neccessary files from docker and ready to be used by a container.

Image reference in the docker hub : https://hub.docker.com/_/php/, the latest one would be php version 7, in this build I want to specifically use php 5.6.x since that is the version used in the production server currently.

@guiwuff
guiwuff / iTerm2-App-Finder-Context-Menu.md
Last active October 17, 2019 19:42
Open iTerm2 App from the context menu of the current finder folder or through shortcut

Open iTerm2 App from Finder context menu

Run iTerm2 Here listed in the context menu of the current Finder's directory, installed as a Service and can have global Keyboard shortcut

Create Service using Automator

Reference : https://gist.github.com/pdanford/158d74e2026f393e953ed43ff8168ec1 Run Automator > New Service > Action > Run Apple Script Service Received Selected Folders in Finder

@guiwuff
guiwuff / iTermOpenScript.app
Last active April 16, 2017 02:02
open iTerm from Finder toolbar using Automator App
# Reference : https://gist.github.com/pdanford/158d74e2026f393e953ed43ff8168ec1
# Open Automator -> Application -> Action -> Run Apple Script
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
@guiwuff
guiwuff / .gitignore
Last active April 15, 2017 14:04
Ignoring directory content in git
# put this file inside the directory to be ignored in git commit
# the folder itself will be included in the commit
*
!.gitignore