Skip to content

Instantly share code, notes, and snippets.

View non7top's full-sized avatar

non7top non7top

  • Bakı
  • 06:40 (UTC +04:00)
View GitHub Profile
@non7top
non7top / sysctl.conf
Last active September 14, 2015 07:48 — forked from kfox/sysctl.conf
Linux kernel tuning settings for large number of concurrent clients
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Purpose : System backup
# Modified 14 Feb 2011
echo "Initializing backup process - " `date`
logger -t backup "System Backup started"
backvol=/bkpv
#
# Sanity Check
#
@non7top
non7top / sni-sniff.py
Last active March 17, 2019 05:12
Allows to dump the hostname header from sni handshake
import os
import BaseHTTPServer, SimpleHTTPServer
import ssl, socket
CERTIFICATE_PATH = os.getcwd() + '/server.crt'
KEY_PATH = os.getcwd() + '/server.key'
def verify_tls(socket, hostname, context, as_callback=True):
print "SNI hostname: ", hostname
@non7top
non7top / upload.php
Created February 5, 2016 12:56
simple upload script
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-utf-8">
<title>utf</title>
</head>
<body>
<?php
print "<h1>#p@$c@#</h1>\n";
echo "Your IP: ";
echo $_SERVER['REMOTE_ADDR'];
@non7top
non7top / rdiffweb.conf
Last active January 15, 2017 00:43
Example configuration for nginx
location /rdiffweb {
rewrite ^([^\?#]*/)([^\?#\./]+)([\?#].*)?$ $1$2/$3 permanent;
# substitute with rdiffweb url
proxy_pass http://127.0.0.1:18080/;
# for https
#proxy_redirect http://example.com https://example.com/rdiffweb;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@non7top
non7top / with_backoff.sh
Created April 11, 2016 19:07
bash function to retry with backoff
function with_backoff {
# http://stackoverflow.com/questions/8350942/how-to-re-run-the-curl-command-automatically-when-the-error-occurs
# by phs
#
# The retry count is given by ATTEMPTS (default 5), the initial backoff
# timeout is given by TIMEOUT in seconds (default 1.)
#
# Successive backoffs double the timeout.
local max_attempts=${ATTEMPTS-5}
@non7top
non7top / in a flask
Created May 12, 2016 09:09 — forked from oxpa/in a flask
range getting files from server
def generate(taskname, ext='html'):
#jobs=get_results_from_redis()
#job = [i for i in jobs if i.name == taskname][0]
try:
logfile = open('/opt/deploy/var/log/tasks/%s.%s'%(taskname, ext), 'r')
except:
raise StopIteration
yield ''.join(logfile.readlines())
#while job.status != 'SUCCESS' and job.status != 'FAIL' and job.status != 'STOP' and logfile:
@non7top
non7top / skeleton-daemon.sh
Created July 6, 2016 12:40 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
@non7top
non7top / mtu_discover.sh
Last active January 12, 2017 05:15
mtu_discover.sh
#!/bin/bash
# original https://idyllictux.wordpress.com/2009/06/19/script-find-maximum-mtu/
# adjusted it to detect pmtu hole
# read https://blog.cloudflare.com/path-mtu-discovery-in-practice/
# https://habrahabr.ru/post/136871/
PKT_SIZE=${2:-1472}
HOSTNAME="$1"
z=$( ping -M do -c 1 -w 3 -s $PKT_SIZE $HOSTNAME 2>&1 )
@non7top
non7top / .htaccess
Created August 17, 2016 12:37
HTTP 451 Unavailable For Legal Reasons
RewriteEngine On
RewriteCond %{REMOTE_HOST} !^192.168
RewriteRule .* 451.php [L]