Skip to content

Instantly share code, notes, and snippets.

@techom
techom / cloudflare-worker-proxy.js
Created March 26, 2023 02:50 — forked from noobnooc/cloudflare-worker-proxy.js
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@techom
techom / update_gfwlist.sh
Created November 25, 2016 09:27 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@techom
techom / weixin.php
Created March 8, 2016 06:43
微信红包算法测试
header("Content-Type: text/html;charset=utf-8");
$total=10; // 红包总额
$num=8; // 分成8个红包,支持8人随机领取
$min=0.01; // 每个人最少能收到0.01元
for ($i=1;$i<$num;$i++)
{
$safe_total = ($total-($num-$i)*$min)/($num-$i); //随机安全上限
$money = mt_rand($min*100, $safe_total*100)/100;
@techom
techom / curl.php
Created March 8, 2016 04:34
curl 获取 https 内容的函数
function getHTTPS($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
@techom
techom / host.txt
Last active March 5, 2016 03:02
最新可用的google hosts文件
# Copyright (c) 2014-2016, racaljk.
# https://github.com/racaljk/hosts
# Last updated: 2016-3-1
# This work is licensed under a CC BY-NC-SA 4.0 International License.
# https://creativecommons.org/licenses/by-nc-sa/4.0/
# Localhost (DO NOT REMOVE)
127.0.0.1 localhost
255.255.255.255 broadcasthost