Skip to content

Instantly share code, notes, and snippets.

View asasmoyo's full-sized avatar
🏠
sleeping 😴

Arba Sasmoyo asasmoyo

🏠
sleeping 😴
View GitHub Profile
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@asasmoyo
asasmoyo / grok-patterns
Last active September 22, 2015 03:29 — forked from mesimeris/grok-patterns
LOGSTASH: syslog listener filtering with grok patterns and applying useful tags
# NOTE: These patterns take into account the additional log-line information passed to the logstash listener from rsyslog. YMMV.
DHCPD ((%{SYSLOGTIMESTAMP:timestamp})\s*(%{HOSTNAME:hostname})\s*dhcpd\S+\s*(%{WORD:dhcp_action})?.*[for|on] (%{IPV4:dhcp_client_ip})?.*[from|to] (%{COMMONMAC:dhcp_client_mac})?.*via (%{USERNAME:interface}))
IPTABLES ((%{SYSLOGTIMESTAMP:nf_timestamp})\s*(%{HOSTNAME:nf_host})\s*kernel\S+\s*(%{WORD:nf_action})?.*IN=(%{USERNAME:nf_in_interface})?.*OUT=(%{USERNAME:nf_out_interface})?.*MAC=(%{COMMONMAC:nf_dst_mac}):(%{COMMONMAC:nf_src_mac})?.*SRC=(%{IPV4:nf_src_ip}).*DST=(%{IPV4:nf_dst_ip}).*PROTO=(%{WORD:nf_protocol}).?*SPT=(%{INT:nf_src_port}?.*DPT=%{INT:nf_dst_port}?.*))
DNS ((%{MONTHDAY:day})-(%{MONTH:month})-(%{YEAR:year}) (%{TIME:timestamp}) client (%{IPV4:dns_client_ip})#(%{NONNEGINT:dns_uuid})?.*query: (%{HOSTNAME:dns_dest}) (%{WORD:dns_type}) (%{WORD:dns_record})?.*(%{IPV4:dns_server}))
PGSQL ((%{SYSLOGTIMESTAMP:pgsql_timestamp}) (%{HOSTNAME:pgsql_hostname})?.*SAST >(%{WORD:pgs
@asasmoyo
asasmoyo / limits.conf
Last active January 14, 2022 02:14
linux sysctl.conf tuning
# /etc/security/limits.conf
* soft nofile 524288
* hard nofile 524288
root soft nofile 524288
root hard nofile 524288
* soft nproc 524288
* hard nproc 524288
root soft nproc 524288
root hard nproc 524288
@asasmoyo
asasmoyo / postgres configs
Last active October 7, 2018 10:14
setup postgresql-10 streaming replication
# /etc/postgresql/10/main/postgresql.conf
include_dir = 'conf.d'
# /etc/postgresql/10/main/conf.d/listen.conf
listen_addresses = '*'
# /etc/postgresql/10/main/conf.d/wal.conf
wal_level = 'replica'
max_wal_senders = 6 # let's set it to 3 * n(slaves)
wal_keep_segments = 500 # number of wal files to keep in master
@asasmoyo
asasmoyo / lmdb.tcl
Created February 27, 2019 07:37 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@asasmoyo
asasmoyo / keybase.md
Created April 23, 2019 14:39
keybase.md

Keybase proof

I hereby claim:

  • I am asasmoyo on github.
  • I am asasmoyo (https://keybase.io/asasmoyo) on keybase.
  • I have a public key whose fingerprint is 51EF BD98 34F7 7A4C D91E 3B0B D037 2AA8 3FCE 25F5

To claim this, I am signing this object: