Skip to content

Instantly share code, notes, and snippets.

@lrhazi
lrhazi / dns_rate_limit_rule.tcl
Created September 15, 2012 21:46
F5 BIGIP DNS Rate Limiting iRule
when RULE_INIT {
# Max queries per second, per client ip
set static::maxconn 100
# Max identical responses per second, per client ip
set static::maxresp 15
# Number of seconds to drop traffic from infringing client ip.
set static::holdtime 15
# Maximum entries in dns_drop session table.
set static::max_drop_entries 1000000
# Maximum per client, per query, table size.
@lrhazi
lrhazi / dns_logger.tcl
Created September 15, 2012 23:59
F5 BIGIP DNS Logger iRule
when CLIENT_ACCEPTED {
set MAX_ELEMENTS 5
set hsl [HSL::open -proto UDP -pool splunk_pool]
set vip [IP::local_addr]
set client_ip [IP::remote_addr]
}
when DNS_REQUEST {
set q_size [DNS::len]
set q_start [clock clicks]
}
import json
import datetime
import time
import thread
import os
from thrift import Thrift
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.protocol.TBinaryProtocol import TBinaryProtocolAccelerated
from pyes import *
@lrhazi
lrhazi / gist:4128735
Created November 22, 2012 00:43
Objectivity test1
import com.objy.db._
import com.objy.db.app._
import scala.collection.mutable.ListBuffer
/*
1768 export PATH=/opt/object/linux86_64/bin:$PATH
1769 oocheckls
1774 sudo mkdir -p /var/object/data
1775 sudo chown ml623 /var/object/data
1776 oonewfd -pagesize 65536 -fdfilepath /var/object/data/skynet.fdb -lockserver $(hostname) /var/object/data/skynet.boot
@lrhazi
lrhazi / Words
Last active December 17, 2015 23:19
Cheat for game "4 Pics 1 Word". run with two arguments, length of word and string of possible letters. It finds a list of possible english words, using /usr/share/dict/words list of words.
import re,sys
from itertools import permutations
def getDict(length):
filename = "/usr/share/dict/words"
words = set(x.strip().upper() for x in open(filename) if len(x.strip()) == length)
return words
if __name__ == "__main__":
@lrhazi
lrhazi / dns_rate_limit_client.tcl
Created March 19, 2014 01:00
F5 GTM iRule: An attempt at RRL Response Rate Limiting
when RULE_INIT {
# Max queries per second, per client ip
set static::maxconn 100
# Max identical responses per second, per client ip
set static::maxresp 20
# Number of seconds to drop traffic from infringing client ip.
set static::holdtime 15
# Maximum entries in dns_drop session table.
set static::max_drop_entries 1000000
# Maximum per client, per query, table size.
FROM stackbrew/ubuntu:saucy
RUN apt-get update
RUN apt-get install -y --force-yes \
software-properties-common \
pciutils \
debconf-utils
RUN add-apt-repository -y ppa:saltstack/salt
RUN apt-get update
@lrhazi
lrhazi / basic.irule.tcl
Last active September 24, 2020 23:10
sample irule
when HTTP_REQUEST {
set uriLowered [string tolower [HTTP::uri]]
if { $uriLowered starts_with "/home" } {
pool home_pool
} else {
pool default_pool
}
}
@lrhazi
lrhazi / copy-contacts.sh
Last active August 14, 2022 12:36
Copy Google Workspace Contacts from one account to another
#!/bin/bash
shopt -s expand_aliases
alias gam='/root/bin/gamadv-xtd3/gam'
if [[ $# -ne 2 ]]; then
echo "Usage: $0 [email protected] [email protected]" >&2
exit 2
fi
USER_SRC=$1