This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Script to gather the list of additionally installed packages on OpenWRT | |
# Author non7top@gmail.com | |
# Dec 2011 | |
#Read all destinations from opkg config | |
DESTINATIONS=`awk '/dest/ {print $3}' /etc/opkg.conf` | |
while read DEST | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{REMOTE_HOST} !^192.168 | |
RewriteRule .* 451.php [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |