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 | |
set -e -u | |
WORK_STATUS=${1:-0} | |
TRAP_STATUS=${2:-0} | |
work() { | |
echo working | |
return $WORK_STATUS | |
} |
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 | |
# copy to: /opt/etc/init.d/S99munin-node | |
# then run: /opt/etc/init.d/S99munin-node start | |
# CUSTOMIZE TO LAN IP | |
LISTEN_ADDR="192.168.0.1:4949" | |
ENABLED=yes | |
PROCS=munin-inetd-c | |
ARGS="$LISTEN_ADDR munin-node-c -d /opt/etc/munin/plugins -D /opt/etc/munin/plugin-conf.d" |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"io" | |
"net" | |
"os" | |
"os/signal" | |
"strconv" |
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
import sys | |
import paramiko | |
print("paramiko version=%s" % (paramiko.__version__,)) | |
print("python version=%d.%d.%d" % sys.version_info[:3]) | |
if len(sys.argv) != 5: | |
print("USAGE: %s ip port user password" % __file__) | |
sys.exit(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
# run_alt_loop() / run_coro_on_other_thread() by Ben Darnell | |
# https://github.com/tornadoweb/tornado/issues/2798#issuecomment-575909528 | |
import asyncio | |
import threading | |
import concurrent | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, RequestHandler | |
# Not asyncio.Future because of multiple threads. |
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
import asyncio | |
import threading | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, RequestHandler | |
def asyncrazy(func, *args): | |
"""run a stand-alone async function synchronously with a thread""" | |
result = None |
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
package main | |
import ( | |
"regexp" | |
"strings" | |
"testing" | |
) | |
var hexVal = [256]bool{ |
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
import logging | |
import tracemalloc | |
from tornado.web import RequestHandler, HTTPError | |
class MemTraceHandler(RequestHandler): | |
def post(self) -> None: | |
action = self.get_argument('action') | |
nframe = self.get_argument('nframe', "6") |
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 | |
set -eu | |
RTSP_URL= | |
RTSP_AUTH= | |
TRANSPORT=tcp | |
TLS_OPTS= | |
WITH_AUDIO=false | |
WITH_VIDEO=true | |
WITH_RTCP=false |
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 | |
set -eu | |
cd $(dirname $0) | |
DESTDIR="static/js" | |
mkdir -p $DESTDIR | |
JQUERY_VER="3.2.1" | |
JQUERY_SHA1="fd81582bf1b15e6747472df880ca822c362a97d1" | |
JQUERY_URL="https://code.jquery.com/jquery-${JQUERY_VER}.js" |
NewerOlder