Skip to content

Instantly share code, notes, and snippets.

@jadbaz
jadbaz / WriteQueueOutboundChannelHandler.java
Last active May 3, 2017 08:01
A Netty 4 ChannelOutboundHandler that implements a queue system to optimize usage and throughput
import io.netty.channel.*;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
public class WriteQueueOutboundChannelHandler extends ChannelOutboundHandlerAdapter {
private static final int QUEUE_SIZE_WARNING = 5000;
private ChannelHandlerContext ctx;
private final Queue<Object> messageQueue = new ConcurrentLinkedQueue<>();
private int qSize = 0; //should make access synchronized
# Install Zenoss
# Zenoss requirements
yum -y remove mysql-libs.x86_64
# Download Zenoss
wget https://codeload.github.com/zenoss/core-autodeploy/tar.gz/4.2.5
tar -xvf 4.2.5
cd core-autodeploy-4.2.5
@jadbaz
jadbaz / aws_rhel7_enable_rhscl.txt
Created January 30, 2019 15:25
Enable RHSCL (RedHat Software Collections) repository on AWS RHEL 7
# Verified on AWS RHEL 7.6 ARM: https://aws.amazon.com/marketplace/server/procurement?productId=c95b737d-270a-4f6a-9429-b7dc4b5d14c2
Login as root
AS root user, edit the repo file (different suffix for intel machines):
$ vi /etc/yum.repos.d/redhat-rhui-arm.repo
Find the below section:
[rhui-rhel-7-server-for-arm-64-rhscl-rhui-rpms]
@jadbaz
jadbaz / etc_incron.d_incrontest
Last active February 14, 2019 12:23
incron test
/tmp/incrontest IN_MOVED_TO sh /root/incrontest.sh $@/$#
@jadbaz
jadbaz / dummy-web-server.py
Last active April 7, 2019 19:45 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Forked from https://gist.github.com/bradmontgomery/2219997
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
Send a HEAD request::
curl -I http://localhost
@jadbaz
jadbaz / reflect.py
Created April 7, 2019 20:17 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@jadbaz
jadbaz / zenoss_list_event_classes.py
Last active July 3, 2019 12:45
Python Script to List Zenoss events in Zendmd
#!/usr/bin/env python
# https://community.zenoss.com/forum/community-home/digestviewer/viewthread?GroupId=19&MessageKey=5a46e08b-1fc2-45eb-be5a-2a428f3ce2fc
import Globals
ZENPACK_NAME="ZenPacks.acme.Classes"
limit = 10000000
classFilter = None
count = 0
ec_count = 0
mappings_count = 0
header="<?xml version=\"1.0\" encoding=\"UTF-8\"?><ZenossEvents>"
line="<ZenossEvent><SourceComponent><device>$2</device></SourceComponent><summary>$4 - ###</summary><eventClassKey>GenericErrorKey</eventClassKey><component></component><severity>$3</severity></ZenossEvent>"
footer="</ZenossEvents>"
body=""
for i in `seq 1 $1`; do
this_line=$(echo $line | sed "s/###/$i/g")
body="${body}${this_line}"
done
@jadbaz
jadbaz / java_curr_date.sh
Created July 18, 2019 08:03
Javac one-liner for getting current date and time
echo "public class T { public static void main (String[] args) { System.out.println(new java.util.Date()); } }" > T.java; javac T.java; java T