Skip to content

Instantly share code, notes, and snippets.

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
# 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.
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)
package main
import (
"flag"
"fmt"
"io"
"net"
"os"
"os/signal"
"strconv"
@ploxiln
ploxiln / S99munin-node
Last active December 5, 2022 04:56
munin-c Entware package
#!/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"
@ploxiln
ploxiln / trapexit.sh
Created January 9, 2024 06:18
testing how bash trap affects exit code
#!/bin/bash
set -e -u
WORK_STATUS=${1:-0}
TRAP_STATUS=${2:-0}
work() {
echo working
return $WORK_STATUS
}