Skip to content

Instantly share code, notes, and snippets.

View partho222's full-sized avatar

Tariq Ahmed Khan partho222

  • Dhaka, Bangladesh
View GitHub Profile
@partho222
partho222 / fork_and_daemon.go
Created March 19, 2023 13:13 — forked from wrfly/fork_and_daemon.go
golang fork and exec and handle signals
package main
import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
)
class RedisSessionStore(SessionStore):
def __init__(self, expire = 1800, key_prefix=''):
SessionStore.__init__(self)
self.redis = redis.Redis(tools.config.get('redis_host', 'localhost'),
int(tools.config.get('redis_port', 6379)),
int(tools.config.get('redis_dbindex', 1)),
password=tools.config.get('redis_pass', None))
self.path = session_path()
self.expire = expire
self.key_prefix = key_prefix
@partho222
partho222 / pgpool2_log_process.txt
Last active February 7, 2022 15:30
Fetch program specific log from syslog to own log file
### Create rsyslog entry to catch log data [based on 'pgpool' name] in '/etc/rsyslog.d/pgpool2.conf'
if ( $programname == "pgpool" ) then {
action(type="omfile" fileOwner="postgres" fileGroup="postgres" fileCreateMode="0644" file="/var/log/pgpool2/pgpool2.log") stop
}
### Create logrotate configuration in '/etc/logrotate.d/pgpool2.conf'
/var/log/pgpool2/pgpool2.log {
daily
rotate 30
compress
@partho222
partho222 / gist:7b649fc7f2328c065dd8cd8f65ebc794
Created March 9, 2021 11:57 — forked from leoapost/gist:4318441
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;
@partho222
partho222 / pihole-custom-adlist.txt
Last active September 27, 2020 17:53
Pi-hole Custom Adlists
# Prevent Trackers and Malwares
https://raw.githubusercontent.com/DRSDavidSoft/additional-hosts/master/domains/blacklist/adservers-and-trackers.txt
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
https://raw.githubusercontent.com/notracking/hosts-blocklists/master/hostnames.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://gitlab.com/my-privacy-dns/matrix/matrix/-/raw/master/source/tracking/domains.list
https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardApps.txt
https://raw.githubusercontent.com/r-a-y/mobile-hosts/master/AdguardMobileAds.txt
https://raw.githubusercontent.com/FadeMind/hosts.extras/master/StreamingAds/hosts
//First commit any outstanding code changes, and then, run this command:
git rm -r --cached .
//This removes any changed files from the index(staging area), then just run:
git add .
//Commit
git commit -m ".gitignore initiated"
@partho222
partho222 / README.md
Last active October 7, 2021 04:06 — forked from tmilos/README.md
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation