Skip to content

Instantly share code, notes, and snippets.

View ed00m's full-sized avatar

ed00m:th3d00m ed00m

View GitHub Profile
@ed00m
ed00m / input.txt
Created September 10, 2020 15:41 — forked from Apsu/input.txt
/etc/network/interfaces parser
# Comment lo
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 162.242.220.169
gateway 162.242.220.1
netmask 255.255.255.0
@ed00m
ed00m / abusehub-reindex.py
Created March 20, 2020 19:13 — forked from EikeDehling/abusehub-reindex.py
Python script to reindex elasticsearch data to monthly indices
#!bin/python
from elasticsearch import Elasticsearch
from datetime import datetime
import time
es = Elasticsearch()
indices_state = es.cluster.state()['metadata']['indices']
@ed00m
ed00m / gzip-demo.py
Created August 31, 2018 16:50 — forked from dreikanter/gzip-demo.py
Create tar.gz archive with Python, unpack files back and check the result
# Python gzip demo: create and unpack archive
import os
import random
import string
import glob
import tarfile
import shutil
import filecmp
@ed00m
ed00m / f5_xfp.txt
Created October 6, 2017 00:31 — forked from dwallraff/f5_xfp.txt
F5 config - X-Forward-Proto (XFP)
Recommended solution would be:
- Use Insert header, in the custom HTTP profile that you applied to the virtual servers.
For HTTPS Virtuals, insert: X-Forwarded-Proto, with a value of https
For HTTP Virtuals, insert: X-Forwarded-Proto, with a value of http
Of course you could also use apply an iRule to the Virtual Server, something like this should work:
when HTTP_REQUEST {
if { [SSL::mode] == 1 } {
@ed00m
ed00m / nginx-tuning.md
Created October 5, 2017 23:35 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@ed00m
ed00m / cs.py
Created August 12, 2016 09:23 — forked from myano/cs.py
Quick example of ncurses in Python!
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()
SELECT id, nombre, (6371 * ACOS(
SIN(RADIANS(lat)) * SIN(RADIANS(4.6665578))
+ COS(RADIANS(lng - -74.0524521)) * COS(RADIANS(lat))
* COS(RADIANS(4.6665578))
)
) AS distance
FROM direcciones
HAVING distance < 1 /* 1 KM a la redonda */
ORDER BY distance ASC
@ed00m
ed00m / gist:cde70256247959e418e9ce837fb6ee9f
Created April 5, 2016 07:22 — forked from s4553711/gist:9488399
Some example for subprocess.Popen exception example
#!/usr/bin/python
import subprocess
import os
import sys
#res = subprocess.Popen(['ls','-al','/ahome'],stdout=subprocess.PIPE,stderr=subprocess.PIPE);
#output,error = res.communicate()
#if res.returncode:
# #raise Exception(error)