Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / etc_incron.d_incrontest
Last active February 14, 2019 12:23
incron test
/tmp/incrontest IN_MOVED_TO sh /root/incrontest.sh $@/$#
@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]
# 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 / 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