Skip to content

Instantly share code, notes, and snippets.

@tomac4t
tomac4t / remove-google-tracking.user.js
Last active July 29, 2023 03:45 — forked from k-barton/remove-google-tracking.user.js
Greasemonkey user script: Remove Google's link tracking
// ==UserScript==
// @name Remove Google's link tracking
// @description Removes onmousedown event from external Google links to allow direct links
// @namespace https://gist.github.com/k-barton
// @include https://www.google.com/search*
// @version 0.2.0
// @grant unsafeWindow
// @run-at document-end
// ==/UserScript==
(function () {
@tomac4t
tomac4t / GoogleRecaptchaConnectivity.js
Last active January 30, 2020 14:15
Google Connectivity Check
var connectivityFirstCheck = true;
var connectivityTestPassed;
// https://github.com/SukkaW/DisqusJS/blob/master/src/disqus.js#L235
const connectivityCheck = () => {
connectivityFirstCheck = false;
const img = new Image;
const timeout = setTimeout(() => {
img.onerror = img.onload = null;
connectivityTestPassed = false;
@tomac4t
tomac4t / keepassxc-build.sh
Last active July 9, 2020 03:30
Building KeePassXC
#!/bin/sh
set -ex
# Get the new version
Version=`curl -sf 'https://api.github.com/repos/keepassxreboot/keepassxc/releases/latest' | python -c "import sys, json; print json.load(sys.stdin)['tag_name']"`;
curl -Lf --proxy socks5://127.0.0.1:1080 "https://github.com/keepassxreboot/keepassxc/releases/download/"$Version"/keepassxc-"$Version"-src.tar.xz" | tar -Jxv;
cd keepassxc-$Version;
unset Version;
if [ -d "build" ]; then
rm -rf build;
fi
@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 {
@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 / 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 / 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 / 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 / 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 / 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 中国 北京 北京 北京科技大学