Skip to content

Instantly share code, notes, and snippets.

@tomac4t
tomac4t / locate_me.html
Created March 31, 2024 13:47
generated by google gemini
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Locate Me</title>
</head>
<body>
<button id="find-me">Locate</button>
<p id="status"></p>
import requests
# replace github personal token
ghp = 'ghp_xxxxxxxxxxxxxxxxxxxxxxxxx'
username = 'JiaT75'
p = 0
def event(p):
params = {
@tomac4t
tomac4t / cernet2-v6.csv
Last active November 5, 2024 06:00
中国教育网学校 IPv6 地址段
IPv6 国家 省份 城市 学校/教育机构
2001:da8:0200::/48 中国 北京 北京 清华大学
2001:da8:0201::/48 中国 北京 北京 北京大学
2001:da8:0202::/48 中国 北京 北京 北京邮电大学
2001:da8:0203::/48 中国 北京 北京 北京航空航天大学
2001:da8:0204::/48 中国 北京 北京 北京理工大学
2001:da8:0205::/48 中国 北京 北京 北京交通大学
2001:da8:0206::/48 中国 北京 北京 北京城市学院
2001:da8:0207::/48 中国 北京 北京 北京师范大学
2001:da8:0208::/48 中国 北京 北京 北京科技大学
@tomac4t
tomac4t / tor-exit.csv
Last active August 31, 2024 02:30
Tor exit nodes geolocation
IP ASN Country Region City Organization
2.58.56.88 210558 Netherlands North Holland Oude Meer 1337 Services GmbH
2.58.56.101 210558 Netherlands North Holland Oude Meer 1337 Services GmbH
2.58.56.106 210558 Netherlands North Holland Oude Meer 1337 Services GmbH
2.58.56.114 210558 Netherlands North Holland Oude Meer 1337 Services GmbH
2.58.56.212 210558 Netherlands North Holland Oude Meer 1337 Services GmbH
3.23.79.223 16509 United States Ohio Columbus AMAZON-02
5.2.67.226 60404 Netherlands North Holland Alkmaar The Infrastructure Group B.V.
5.2.70.140 60404 Netherlands North Brabant Wagenberg The Infrastructure Group B.V.
5.2.70.223 60404 Netherlands North Brabant Wagenberg The Infrastructure Group B.V.
@tomac4t
tomac4t / upload-release-assets.py
Last active January 17, 2023 01:16
A python script to upload the release assets via the GitHub Release API.
#!/usr/bin/python3
# A python script to upload the release assets via the GitHub Release API.
import mimetypes
import os
import requests
import sys
# Written for Github actions when release created event is triggered.
# It must set the env variables in the GitHub actions file:
# env:
@tomac4t
tomac4t / ipip-bt.py
Last active April 3, 2024 12:33
IPIP Firefox Extension API
#!/usr/bin/python3
import requests
import sys
n = len(sys.argv)
for i in range (1, n):
ipipapi = "https://btapi.ipip.net/host/info?ip=" + sys.argv[i] + "&host=&lang=cn"
@tomac4t
tomac4t / Github-MITM-20200326.md
Last active January 17, 2023 01:18
Github Pages MITM

Github MITM

openssl

$ openssl s_client -connect pages.github.com:443 -showcerts
CONNECTED(00000003)
depth=1 C = CN, ST = GD, L = SZ, O = COM, OU = NSP, CN = CA, emailAddress = [email protected]
verify error:num=19:self signed certificate in certificate chain
verify return:1
depth=1 C = CN, ST = GD, L = SZ, O = COM, OU = NSP, CN = CA, emailAddress = [email protected]
verify return:1
@tomac4t
tomac4t / cnki-pdf-download.user.js
Last active January 17, 2023 01:18
Provide PDF download button for master's thesis on cnki.net
// ==UserScript==
// @name cnki-pdf-download.user.js
// @namespace https://tomcat.one/
// @version 1.4
// @description Provide PDF Download button for master's thesis on cnki.net
// @author tomacat
// @match http://kns.cnki.net/KCMS/detail/detail.aspx?*
// @match https://kns.cnki.net/KCMS/detail/detail.aspx?*
// @grant none
// @license The Unlicense
@tomac4t
tomac4t / ip.php
Last active March 12, 2023 10:32
MaxMind DB Reader PHP API example code https://github.com/maxmind/MaxMind-DB-Reader-php
<?php
require_once 'MaxMind-DB-Reader-php/autoload.php';
use MaxMind\Db\Reader;
$ipAddress = $_SERVER['REMOTE_ADDR'];
if (isset ($_POST["ip"]) ) {
if (filter_var($_POST["ip"], FILTER_VALIDATE_IP)) {
$ipAddress = $_POST["ip"];
} else {