Skip to content

Instantly share code, notes, and snippets.

View ahxxm's full-sized avatar
🚘
On The Road

ahxxm ahxxm

🚘
On The Road
View GitHub Profile
@ahxxm
ahxxm / index-patch-notionai.js
Last active March 11, 2023 13:17
a patch for TBXark/ChatGPT-Telegram-Workers to use notion API
async function sendMessageToChatGPT(message, history) {
try {
const payload = {
model: "openai-3",
spaceId: "", // your space id here
isSpacePermission: false,
id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
}),
@ahxxm
ahxxm / flash_gen_crc_list.py3
Last active February 18, 2023 13:30
python3 compatible crclist.txt file update script, use after patching boot.img. backup sparsecrc.txt in case failed to flash `super`
#!/usr/bin/env python
# fixes: 2to3 syntax, assertions for int(d1/d2) value
from __future__ import print_function
import getopt, posixpath, signal, struct, sys
import os, copy
import binascii
sparse_file_list = {
"super":"super.img",
"cust":"cust.img",
@ahxxm
ahxxm / 2022-hashcode-one-pizza.ipynb
Last active April 24, 2022 11:54
2022 hashcode practice round one pizza, simply random, 2 5 5 1803 2049
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ahxxm
ahxxm / cloudflare-ddns.go
Last active November 21, 2022 15:07
cloudflare ddns
package main
// env GOOS=linux GOARCH=arm go build -ldflags="-s -w" -v a.go
// upx --best --ultra-brute main
import (
"fmt"
"time"
"github.com/cloudflare/cloudflare-go"
@ahxxm
ahxxm / doubanbook-cralwer.clj
Last active November 21, 2022 13:59
title + <div id="info" /> => local redis
(ns doubanbook-cralwer.core
(:require [clj-http.client :as http]
[clojure.core.async :refer [go-loop chan <! >!! <!!] :as a]
[taoensso.carmine :as car :refer (wcar)])
(:gen-class))
(def ua "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36")
(def redis-opts {:pool {} :spec {:uri "redis://127.0.0.1:6379/0"}})
(defmacro wcar* [& body] `(car/wcar redis-opts ~@body))
(def seen (atom (into #{} (wcar* (car/keys "*")))))
@ahxxm
ahxxm / gist:f4e7311a6e26be4ade4fb574b4183502
Created August 23, 2018 08:25 — forked from parano/gist:1868242
Excel表格密码保护的解除方法
表格受密码保护时,我们修改数据Excel弹出“您试图更改的单元格或图表受保护,因而是只读的。
若要修改受保护单元格或图表,请先使用‘撤消工作表保护’命令(在‘审阅’选项卡的‘更改’组中)来取消保护。
可能会提示输入密码。这时候我们可以用VBA宏代码破解法来破解表格保护密码:
第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,
打开“Microsoft Office安全选项”窗口,选择其中的“启用此内容”,“确定”
再切换到“视图”选项卡,点击“宏”→“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:
PasswordBreaker,点击“确定”退出;
第二步:再点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,
打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗口中的所有代码:
@ahxxm
ahxxm / _auth.py
Created February 2, 2017 10:55 — forked from virantha/_auth.py
Uploading PDFS to Evernote using the Python API
def _connect_to_evernote(self, dev_token):
user = None
try:
self.client = EvernoteClient(token=dev_token)
self.user_store = self.client.get_user_store()
user = self.user_store.getUser()
except EDAMUserException as e:
err = e.errorCode
print("Error attempting to authenticate to Evernote: %s - %s" % (EDAMErrorCode._VALUES_TO_NAMES[err], e.parameter))
return False
@ahxxm
ahxxm / SimpleHTTPServerWithUpload.py
Created November 14, 2016 12:37 — forked from touilleMan/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@ahxxm
ahxxm / tor_vote.py
Created December 9, 2015 09:52
tor_vote.py
import json
import requests
import random
import socket
import socks
import time
from subprocess import call
# Mount Tor proxy into requests
@ahxxm
ahxxm / weibosync.py
Created October 7, 2015 10:11
weibo同步
from weibo import Client
from twitter import *
import json
import re
import requests
import Image
from StringIO import StringIO
import sys
reload(sys)
sys.setdefaultencoding("utf-8")