Skip to content

Instantly share code, notes, and snippets.

View non7top's full-sized avatar

non7top non7top

  • Pattaya
  • 04:50 (UTC +07:00)
View GitHub Profile
@non7top
non7top / check_http_wget
Created April 12, 2017 17:26
check_http_wget
#!/bin/bash
exec 2>&1
[ -d /dev/shm -a -w /dev/shm ] && export TMPDIR=/dev/shm
# Parsing Input Parameters {{{
#####################################################################
allparams=$*
iroute 192.168.2.0 255.255.255.0
ifconfig-push 192.168.5.3 192.168.5.4
@non7top
non7top / dump_cert.sh
Last active January 27, 2017 15:01
Dump remote site certificate
#!/bin/bash
SITE=${1}
openssl s_client -connect ${SITE}:443 -servername $SITE </dev/null 2>/dev/null | openssl x509 -outform PEM > $SITE.pem
echo saved as $SITE.pem
@non7top
non7top / custom-error-page
Created January 25, 2017 14:06 — forked from simlegate/custom-error-page
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@non7top
non7top / pkgs.sh
Created November 16, 2016 17:33
Script to gather the list of additionally installed packages on OpenWRT
#!/usr/bin/env bash
# Script to gather the list of additionally installed packages on OpenWRT
# Author [email protected]
# Dec 2011
#Read all destinations from opkg config
DESTINATIONS=`awk '/dest/ {print $3}' /etc/opkg.conf`
while read DEST
do
@non7top
non7top / sniff.txt
Created September 17, 2016 15:25 — forked from manifestinteractive/sniff.txt
A friendly formatter for curl requests to help with debugging.
\n
============= HOST: ==========\n
\n
local_ip: %{local_ip}\n
local_port: %{local_port}\n
remote_ip: %{remote_ip}\n
remote_port: %{remote_port}\n
\n
======= CONNECTION: ==========\n
\n
@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]
@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 / 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 / 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: