Skip to content

Instantly share code, notes, and snippets.

View narate's full-sized avatar

Narate Ketram narate

View GitHub Profile
@narate
narate / docker-compose.yml
Created November 22, 2022 09:23
Docker compose file for PostgreSQL with tuning config example
version: '3'
services:
db:
restart: always
image: postgres:14-alpine
shm_size: 256mb
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- ./postgres14:/var/lib/postgresql/data
@narate
narate / post-function.lua
Created June 6, 2022 08:56
Kong Serverless Function
local kong = kong
local re = ngx.re
local headers = kong.response.get_headers()
local content_type = headers["Content-Type"]
local supported_content_type = "(html|json|xml|plain|css)"
local function transform_body(body, old, new)
return body:gsub(old, new)
end
@narate
narate / srcache.conf
Created May 2, 2022 08:11
The srcache-nginx-module example config for WordPress with php-fpm
server {
listen 80;
server_name _;
root /var/www/html;
index index.php;
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
@narate
narate / parsers.conf
Last active October 7, 2021 03:54
Fluent-bit auth log parser (/var/log/auth.log) https://rubular.com/r/kR7esS0duCgtoR
[PARSER]
Name auth
Format regex
Regex ^(?<time>[^ ].* \d+ \d{2}:\d{2}:\d{2}) (?<host>[\S]*) (?<program>[^\[\] ]*)(\[(?<pid>\d*)\])?: (?<message>.*)$
Time_Key time
Time_Format %b %d %H:%M:%S
Time_Keep Off
# Time_Offset +0700
@narate
narate / เพลงคืนความสุขให้ประเทศไทย.txt
Last active August 16, 2021 16:41
เนื้อเพลง .....เพลง...คืนความสุขให้ประเทศไทย .... เนื้อร้องโดย พล.อ.ประยุทธ์ จันทร์โอชา ผบ.ทบ./หัวหน้าคณะ คสช. เรียบเรียงค าร้องและท านองโดย วิเชียร ตันติพิมลพันธุ์
วันที่ชาติและองค์ราชา มวลประชาอยู่มาพ้นภัย
ขอดูแลคุ้มครองด้วยใจ นี่คือคำสัญญา
วันนี้ชาติเผชิญพาลภัย ไฟลุกโชนขึ้นมาทุกครา
ขอเป็นคนที่เดินเข้ามา ไม่อาจให้สายไป
เพื่อนำรักกลับมา ต้องใช้เวลาเท่าไร
โปรด จงรอได้ไหม จะข้ามผ่านความบาดหมาง
เราจะทำตามสัญญา ขอเวลาอีกไม่นาน
แล้วแผ่นดินที่งดงามจะคืนกลับมา
เราจะทำอย่างซื่อตรง ขอแค่เธอจงไว้ใจและศรัทธา
แผ่นดินจะดีในไม่ช้า ขอคืนความสุขให้เธอ ประชาชน
@narate
narate / create-pg-user.sh
Created January 26, 2021 05:20
Create PostgreSQL user/password wirh database in PostgreSQL running in docker container
#!/bin/sh
# https://github.com/docker-library/postgres/issues/151
set -x
POSTGRES="psql --username ${POSTGRES_USER}"
echo "Before"
echo "======"
$POSTGRES <<-SQL
@narate
narate / PS1.sh
Created September 29, 2020 04:22
My $PS1 for bash
export PS1=\[\e[0;7;37m\] \[\e[0;1;7;37m\]\t\[\e[0;7;37m\] \[\e[0;7;38;5;33m\] \[\e[0;7;38;5;33m\]\u\[\e[0;7;38;5;33m\] \[\e[0;7;38;5;40m\] \[\e[0;7;38;5;40m\]\w\[\e[0;7;38;5;40m\] \[\e[0;7;38;5;202m\] ⎇ \[\e[0;7;38;5;202m\]$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\[\e[0;7;38;5;202m\] \[\e[0m\]\[\e[m\]\n\[\e[0m\]\$\[\e[m\] \[\e0
@narate
narate / docker-compose.yml
Created May 24, 2020 07:03
Pi-Hole Docker Compose
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
@narate
narate / php-pools.md
Created August 24, 2019 10:43 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@narate
narate / user-agent.txt
Created January 23, 2019 04:44
Sample user-agent
This file has been truncated, but you can view the full file.
$ua.tools.random()
%E7%94%BB%E5%83%8F%E6%A4%9C%E7%B4%A2/3 CFNetwork/889.9 Darwin/17.2.0
%E7%94%BB%E5%83%8F%E6%A4%9C%E7%B4%A2/3 CFNetwork/901.1 Darwin/17.6.0
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15'
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
'Mozilla/5.0 (compatible; DuckDuckBot-Https/1.1; https://duckduckgo.com/duckduckbot)'
-
@GCHQ @russia Did you ever play tic-tac-toe?
@lo_security scan-01.lo-sec.online
Aastra 6731i/2.6.0.66