Skip to content

Instantly share code, notes, and snippets.

View fffonion's full-sized avatar

Wangchong Zhou fffonion

View GitHub Profile
@fffonion
fffonion / main.cpp
Created June 30, 2020 09:20
Read Xiaomi Mijia temperature and humidity sensor 2 (LYWSD03MMC) from ESP32
#include <Arduino.h>
#include <BLEDevice.h>
BLEClient *pClient;
BLEScan *pBLEScan;
#define SCAN_TIME 10 // seconds
bool connected = false;
@fffonion
fffonion / patch_nginx_listeners.py
Last active January 14, 2024 23:05
Patch nginx configurations to add quic listeners and use new http2 directive.
#!/usr/bin/env python3
import os
import re
import sys
import argparse
def modify(path, args):
print("DO: ", path)
@fffonion
fffonion / replaceCert.ps1
Created December 19, 2023 14:20
Replace cert for Remote desktop and Windows Admin Center
function 测试UAC
{
[OutputType([bool])]
param()
process {
[Security.Principal.WindowsPrincipal]$用户 = [Security.Principal.WindowsIdentity]::GetCurrent();
return $用户.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator);
}
}
@fffonion
fffonion / setup-dashbutton.py
Created September 28, 2019 22:32
Setting up dash button without Amazon App
import requests
import re
import sys
# Initial work from: https://mpetroff.net/2016/07/new-amazon-dash-button-teardown-jk29lp/
h = requests.Session()
BASE_URL = "http://192.168.0.1"
@fffonion
fffonion / github-widescreen.user.js
Last active September 25, 2023 08:43
github-widescreen.user.js
// ==UserScript==
// @name Github Widescreen Fix
// @namespace http://tampermonkey.net/
// @updateURL https://gist.github.com/fffonion/4f7bd4511ca1b6798ec422ae37fd5376/raw/github-widescreen.user.js
// @downloadURL https://gist.github.com/fffonion/4f7bd4511ca1b6798ec422ae37fd5376/raw/github-widescreen.user.js
// @version 0.2
// @description try to take over the world!
// @author You
// @match https://github.com/*/*/actions/runs/*/job/*
// @match https://github.com/*/*
@fffonion
fffonion / .htaccess
Last active September 20, 2023 00:40
Google镜像 恢复背景图片,代理谷歌快照,去除了url跳转,关闭安全搜索 http://g.yooooo.ushttp://gc.yooooo.us
#Redirect 301 ^/$ /search.htm
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !^/index\.htm
#RewriteCond %{REQUEST_URI} !^/image\.htm
#RewriteCond %{REQUEST_URI} !^/m\.htm
#RewriteCond %{REQUEST_URI} !^/mi\.htm
@fffonion
fffonion / extract_subtitles.sh
Last active August 26, 2023 21:10
Extract subtitles track
#!/bin/bash
f="$1"
IFS=$'\r\n'
filename="${f%.*}"
bf=$(basename "$filename")
options=()
moptions=()
for s in $(ffprobe "$f" -show_entries stream=index,codec_type,codec_name:stream_tags=language,title -of compact 2>/dev/null|grep "codec_type=subtitle"); do
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
extra-index-url = https://pypi.org/simple
https://download.pytorch.org/whl/cu113
@fffonion
fffonion / Readme.md
Last active November 16, 2022 08:57
Simple GeoIP and ASNnum query server http://ip.yooooo.us
  • nginx with ngx_http_geoip_module, echo-nginx-module, lua-nginx-module is required; libgeoip needs to be installed and geoip database should be placed under /usr/share/GeoIP.
  • http://example.com for current GeoIP and http://example.com/ip for current IP only
  • http://example.com/x.x.x.x to query any IP.
  • http://example.com/domain-name for GeoIP of domain-name and http://example.com/domain-name/ip to return IP of domain-name only. If multiple IPs are set to single domain-name, all of them will be returned. Only A record will be used.
  • Sample requests are:
$ curl http://example.com/
x.x.x.x
Country, Region, City
ASN number
@fffonion
fffonion / artemis.py
Last active August 1, 2022 06:03
artemis resource unpack
# coding:utf-8
import struct
import os
import os.path as opth
import sys
__version__ = 1.0
getPATH0 = lambda: sys.path[0].decode(sys.getfilesystemencoding())
# 命令行处理