Skip to content

Instantly share code, notes, and snippets.

@oasisfeng
oasisfeng / verify_google_ips.sh
Created April 28, 2023 16:29
Shell script to verify connectable Google IPs
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <IP>[/subnet]"
exit 1
fi
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 https://www.google.com.hk 2>&1)
@waylybaye
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 = functions.analytics.event('in_app_purchase').onLog((event) => {
const purchaseValue = event.valueInUSD;
if (purchaseValue > 0) {
const bot = new TelegramBot(token, {polling: false});
@ChadDevOps
ChadDevOps / clamd.conf
Created February 8, 2020 04:30
clamonacc for Ubuntu 18.04
#/etc/clamav/clamd.conf
#Used with Virtualmin
#Tweak as needed
TCPSocket 3333
TCPAddr 127.0.0.1
User root
ScanMail true
ScanArchive true
ArchiveBlockEncrypted false
@chrisklaiber
chrisklaiber / SimpleHTTPServer6.py
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
xujiaao / android-set-ntp-server.md
Last active April 17, 2024 03:40
Set the NTP server of your android device
tags
Android
Android Things

Set the NTP server of your android device

@bmcculley
bmcculley / dummy-web-server.py
Last active November 17, 2022 04:02 — forked from bradmontgomery/dummy-web-server.py
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.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@mdonkers
mdonkers / server.py
Last active April 25, 2024 10:25
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
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
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 https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@Mygod
Mygod / iperf.sh
Last active November 30, 2019 22:18 — forked from madeye/iperf.sh
Bandwidth test for shadowsocks
#!/bin/bash
number=$1
method=$2
ss-tunnel -k test -m $method -l 8387 -L 127.0.0.1:8388 -s 127.0.0.1 -p 8389 &
ss_tunnel_pid=$!
ss-server -k test -m $method -s 127.0.0.1 -p 8389 &
ss_server_pid=$!
@FauxFaux
FauxFaux / do-release-upgrade.md
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.