Skip to content

Instantly share code, notes, and snippets.

View farrokhi's full-sized avatar
🚀

Babak Farrokhi farrokhi

🚀
View GitHub Profile
@farrokhi
farrokhi / postfix-rbl.md
Last active July 22, 2021 04:07
Current Effective RBL Setup for Postfix

Current Effective RBL Setup for Postfix

main.cf:

    smtpd_recipient_restrictions =
      permit_mynetworks,
      permit_sasl_authenticated,
      reject_non_fqdn_hostname,
      reject_non_fqdn_sender,
 reject_non_fqdn_recipient,
@farrokhi
farrokhi / bad-mx.txt
Created February 14, 2016 11:45
List of domains with bad MX record
500px.com
59saniye.com
8tracks.com
about.me
alarabiya.net
anonymox.net
archive.is
ashleymadison.com
badoo.com
badoocdn.com
@farrokhi
farrokhi / mbuf_autotune.sh
Last active November 10, 2023 18:43
Script to suggest optimum mbuf tunables based on your hardware configuration (FreeBSD)
#!/bin/sh
#
# Copyright (c) 2016 Babak Farrokhi. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
@farrokhi
farrokhi / cpuflags.sh
Created August 16, 2016 09:33
Script to detect best cpuflags settings for CC
#!/bin/sh
COMPILERS="clang gcc gcc45 gcc46 gcc47 gcc48 gcc49 gcc5 gcc6"
check_compilers()
{
echo "Looking for available C compilers..."
for C in ${COMPILERS}
do
P=`which ${C} 2>&1`
@farrokhi
farrokhi / nullroute.sh
Created August 16, 2016 09:35
Add/Remove null routes with permanent configuration (FreeBSD)
#!/bin/sh
#
# Copyright (c) 2015 Babak Farrokhi. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@farrokhi
farrokhi / splitgateway.sh
Created August 16, 2016 09:36
Split default route into multiple smaller routes (FreeBSD)
#!/bin/sh
#
# Split default route into 8 smaller routes to avoid
# lock contention during route lookup
#
# If a default router is not specified, it will be
# taken from rc.conf.
#
ROUTECMD="/sbin/route -q "
@farrokhi
farrokhi / sort-vs-gsort.md
Last active October 28, 2019 12:05
BSD sort vs GNU sort

dataset size

# wc -l bigdata-random.csv
 13013886 bigdata-random.csv

tools

@farrokhi
farrokhi / freebsd-ddb.md
Last active January 19, 2020 11:22
Using FreeBSD Text Dumps

If you need to debug a panic on a remote FreeBSD system, but don't want to transfer large coredumps, and can't afford the downtime caused by KDB interrupting the boot process, a text dump may be the answer. textdump(4) is the kernel dump facility, which allows you to see the crash information in a text format. It also allows for configuration of exactly what information is captured, by scripting input as if you were at the KDB prompt on the console.

Textdump has certain requirements. First, you must be running FreeBSD 7.1 or higher, and your kernel config must include the following options.

options DDB
options KDB
options KDB_UNATTENDED
options KDB_TRACE
@farrokhi
farrokhi / dnskey-result.txt
Last active October 20, 2017 11:10
Sad state of DNSSEC adoption with top domains
#
# The output from my check-dnskey.sh script that requests DNSKEY record
# from top 100 domain names and prints the key if there was any.
# last updated on 2017-oct-20
#
google.com NO
youtube.com NO
facebook.com NO
baidu.com NO
wikipedia.org NO
@farrokhi
farrokhi / cscope.md
Created May 30, 2018 07:40
Setting up cscope for a (large) C project

build/update database:

cd $PROJ_DIR
find . -path .git -path .svn -prune -o -name "*.[ch]" > cscope.files
cscope -bqk

browse code:

cscope -d