Skip to content

Instantly share code, notes, and snippets.

oasisfeng /
Created April 28, 2023 16:29
Shell script to verify connectable Google IPs
if [ $# -ne 1 ]; then
echo "Usage: $0 <IP>[/subnet]"
exit 1
for ip in $(nmap -sL $1 | awk '/Nmap scan report/{print $NF}'); do {
ip=$(echo $ip | tr -d '()')
output=$(curl --connect-to :443:$ip:443 --connect-timeout 5 --verbose --head 2>&1)
waylybaye / index.js
Last active March 10, 2022 11:09
Send Notification using Telegram when new IAP is purchased
const functions = require('firebase-functions');
const TelegramBot = require('node-telegram-bot-api');
const token = "***"
const chatID = 1024 // your telegram id, you must first send a message to your bot
exports.notifyIAP ='in_app_purchase').onLog((event) => {
const purchaseValue = event.valueInUSD;
if (purchaseValue > 0) {
const bot = new TelegramBot(token, {polling: false});
ChadDevOps / clamd.conf
Created February 8, 2020 04:30
clamonacc for Ubuntu 18.04
#Used with Virtualmin
#Tweak as needed
TCPSocket 3333
User root
ScanMail true
ScanArchive true
ArchiveBlockEncrypted false
chrisklaiber /
Created February 15, 2018 16:16
Python SimpleHTTPServer over IPv6. Run as `python -m SimpleHTTPServer6 [PORT]`
import BaseHTTPServer
import SimpleHTTPServer
import socket
class HTTPServer6(BaseHTTPServer.HTTPServer):
address_family = socket.AF_INET6
if __name__ == '__main__':
xujiaao /
Last active April 17, 2024 03:40
Set the NTP server of your android device
Android Things

Set the NTP server of your android device

bmcculley /
Last active November 17, 2022 04:02 — forked from bradmontgomery/
a minimal http server in python (2/3). Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
Very simple HTTP server in python.
./ [<port>]
Send a GET request::
curl http://localhost
mdonkers /
Last active June 10, 2024 18:44
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
./ [<port>]
from http.server import BaseHTTPRequestHandler, HTTPServer
simonw /
Last active June 21, 2024 00:11
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using and

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
Mygod /
Last active November 30, 2019 22:18 — forked from madeye/
Bandwidth test for shadowsocks
ss-tunnel -k test -m $method -l 8387 -L -s -p 8389 &
ss-server -k test -m $method -s -p 8389 &
FauxFaux /
Last active May 13, 2023 20:43
What does Ubuntu's do-release-upgrade script actually do?

Ubuntu encourage upgrading between releases by running a command, instead of by manually editing sources and getting on with it. This tool's name is do-release-upgrade, and I believe it should just be doing:

sed -i 's/wily/xenial/g' /etc/apt/sources.list /etc/apt/sources.list.d/*

This command does not explain what it wants to do, or why it is doing anything. It has, in the past:

  • Disabled repos I was using, and hence broken the software in them.