Skip to content

Instantly share code, notes, and snippets.

View yaoxinghuo's full-sized avatar
🎯
Focusing

Terry Yao yaoxinghuo

🎯
Focusing
View GitHub Profile
@yaoxinghuo
yaoxinghuo / README.MD
Created October 15, 2022 13:16 — forked from ihciah/README.MD
A reverse proxy for Telegram Bot API on Aliyun Function Compute / Cloudflare Workers

A reverse proxy for Telegram Bot API on Aliyun Function Compute / Cloudflare Workers

To help users in China mainland access telegram api stably and conveniently with low cost, this script maybe the one you need.

The server-less means you don't have to run a server to proxy the requests, just pay as you go.

Usage

Edit key_prefix, set it to the prefix of you bot address(like /bot563441998:) can avoid abusing.

{
"log": {
"access": "/home/vcap/logs/access.log",
"error": "/home/vcap/logs/error.log",
"loglevel": "warning"
},
"inbounds": [{
"port": 8080,
"protocol": "vmess",
"settings": {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.google.Chrome</key>
@yaoxinghuo
yaoxinghuo / auto_switch_kb.py
Created January 31, 2016 10:19 — forked from tiann/auto_switch_kb.py
auto switch keyboard to english in specific applications
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
'''
from AppKit import NSWorkspace, NSWorkspaceDidActivateApplicationNotification, NSWorkspaceApplicationKey
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@yaoxinghuo
yaoxinghuo / HistogramFilter.java
Created March 7, 2014 05:57
Java比较图片相似度
package com.terrynow.test.imagecompare;
import java.awt.image.BufferedImage;
public class HistogramFilter {
private int redBins;
private int greenBins;
private int blueBins;
@yaoxinghuo
yaoxinghuo / new_gist_file
Created January 20, 2014 08:53
objective c 多线程GCD
dispatch_queue_t serverDelaySimulationThread = dispatch_queue_create("com.xxx.serverDelay", nil);
dispatch_async(serverDelaySimulationThread, ^{
[NSThread sleepForTimeInterval:10.0];
dispatch_async(dispatch_get_main_queue(), ^{
//Your server communication code here
});
});
@yaoxinghuo
yaoxinghuo / new_gist_file.java
Created January 15, 2014 01:42
Java的通配符比较字符串
public class Test3 {
private static final String PATTERN_LINE_START = "^";
private static final String PATTERN_LINE_END = "$";
private static final char[] META_CHARACTERS = { '$', '^', '[', ']', '(',
')', '{', '}', '|', '+', '.', '\\' };
public static void main(String[] args) throws Exception {
@yaoxinghuo
yaoxinghuo / new_gist_file
Created January 15, 2014 01:31
C通配符字符串比较
bool matchWildcards(const char *pattern, const char *content) {
// if we reatch both end of two string, we are done
if ('\0' == *pattern && '\0' == *content)
return true;
/* make sure that the characters after '*' are present in second string.
this function assumes that the first string will not contain two
consecutive '*'*/
if ('*' == *pattern && '\0' != *(pattern + 1) && '\0' == *content)
return false;
@yaoxinghuo
yaoxinghuo / new_gist_file
Created December 8, 2013 10:45
FMDB HelloWorld
//使用 FMDB 只要加入libsqlite3.0.dylib 好像 libsqlite3.dylib 也可以没差别。。。
//注意占位符后面的参数需要是 NSString NSNumber 这样的,不能是 int bool,NSInteger 这些
- (BOOL)saveUser:(NSString *)name age:(int)age sex:(bool)male {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentDir = [paths objectAtIndex:0];
NSString *dbpath = [documentDir stringByAppendingPathComponent:@"user.db"];
FMDatabase *db = [FMDatabase databaseWithPath:dbpath];
if (![db open]) {
return NO;