Skip to content

Instantly share code, notes, and snippets.

View vpnwall-services's full-sized avatar

Vpnwall Services vpnwall-services

View GitHub Profile
@christiannelson
christiannelson / haproxy-ssl.cfg
Created October 16, 2012 17:35
HAProxy Configurations
# References:
# http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/
# http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/
#
global
nbproc 2
maxconn 16384
defaults
@ctolsen
ctolsen / curl_to_ab.py
Last active May 15, 2022 16:19
"Copy to cURL" in Chrome to Apache Bench command
#!/usr/bin/env python3
import sys
import os
def curl_to_ab(curl_cmd: list, num: int=200, cur: int=4) -> str:
"""
Translate a cURL command created by Chrome's developer tools into a
command for ``ab``, the ApacheBench HTTP benchmarking tool.
@jrrdev
jrrdev / logstash.conf
Created October 6, 2017 01:34
Logstash conf to parse Apache logs
# Configuration to parse Apache logs with parameters :
# LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %T %D \"%{Referer}i\" \"%{User-Agent}i\""
input {
tcp {
port => 5000
type => "apache-access"
}
udp {
@elnappo
elnappo / logstash-suricata.conf
Last active August 22, 2022 06:21
Suricata Logstash Elasticsearch
input {
file {
path => ["/var/log/suricata/eve.json"]
sincedb_path => ["/var/lib/logstash/since.db"]
codec => json
type => "SuricataIDPS"
}
}
filter {
if [event][module] == "apache" {
if [fileset][name] == "access" {
grok {
match => { "message" => [
"%{IPORHOST:[source][address]} - %{DATA:[user][name]} \[%{HTTPDATE:[apache][access][time]}\] \"(?:%{WORD:[http][request][method]} %{DATA:[url][original]} HTTP/%{NUMBER:[http][version]:float}|-)?\" %{NUMBER:[http][response][status_code]:int} (?:%{NUMBER:[http][response][body][bytes]:int}|-)( \"%{DATA:[http][request][referrer]}\")?( \"%{DATA:[user_agent][original]}\")?",
"%{IPORHOST:[source][address]} - %{DATA:[user][name]} \[%{HTTPDATE:[apache][access][time]}\] \"-\" %{NUMBER:[http][response][status_code]:int} -",
"\[%{HTTPDATE:[apache][access][time]}\] %{IPORHOST:[source][address]} %{DATA:[apache][access][ssl][protocol]} %{DATA:[apache][access][ssl][cipher]} \"%{WORD:[http][request][method]} %{DATA:[url][original]} HTTP/%{NUMBER:[http][version]:float}\" %{NUMBER:[http][response][body][bytes]:int}"]
}
remove_field => [ "message" ]
add_field => { "[event][created]" => "%{@timestamp}" }
@andrew-d
andrew-d / freeotp-redisplay.py
Created September 21, 2016 07:35
Read a FreeOTP tokens.xml file and display the entries as QR codes
#!/usr/bin/env python
from __future__ import print_function
import base64
import ctypes
import json
import subprocess
import sys
import xml.etree.ElementTree as ET
@sourcec0de
sourcec0de / haproxy.cfg
Created October 18, 2016 16:04
Here's a sample WORKING haproxy config for websockets / socketio. We were able to get socketio working on an Amazon ELB with just one node, but when we added multiple nodes, we saw weird client issues. So, we decided to use HAProxy on Ubuntu 12.04 and spent significant time trying to get just the right configuration (haproxy.cfg). Note though th…
global
#debug
#daemon
log 127.0.0.1 local0
defaults
log global
option httplog
frontend unsecured *:80
@abalter
abalter / argparse1.md
Last active May 30, 2023 11:51
Python Aargparsing Examples

http://stackoverflow.com/a/30493366/188963

Other answers do mention that argparse is the way to go for new Python, but do not give usage examples. For completeness, here is a short summary of how to use argparse:

1) Initialize

import argparse

# Instantiate the parser

parser = argparse.ArgumentParser(description='Optional app description')

@dnozay
dnozay / README.md
Last active May 31, 2023 02:12
Collection of useful stuff for interacting with gitlab.

Reset root/admin password

Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.

# start the console
sudo gitlab-rails console
#!/usr/bin/env python
import dns.resolver
main_domain = "mail-out.ovh.net."
cur_mailout=1
while True:
try:
mail_out_answer = dns.resolver.query('mo' + str(cur_mailout) + '.' + main_domain,'A')
except dns.resolver.NXDOMAIN: