Skip to content

Instantly share code, notes, and snippets.

View flymrc's full-sized avatar
🙈
On vacation

ruichao.ma flymrc

🙈
On vacation
View GitHub Profile
@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active June 25, 2024 09:44
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.
@quchao
quchao / How_to_Enable_gRPC_Binary_Module_in_WeChat_Mini_Program_Cloud_Functions.md
Created April 10, 2020 08:30
在微信小程序云函数中使用 gRPC 二进制模块。

在微信小程序云函数中使用 gRPC 二进制模块。

[TOC]

截止 10 Apr, 2020 , 微信小程序的云函数仅支持 Node.js 语言,函数在生产环境执行于 CentOS 7.2 的 Node.js 8.9,因此若有二进制模块使用需求请注意相关配置。

现以 gRPC 为例说明。

本地调试

@cdeath
cdeath / ffmpeg_mkv_ops.md
Last active June 9, 2024 11:04
extract stuff from .mkv with ffmpeg
@ogl4jo3
ogl4jo3 / blaze_face_detect.py
Created September 11, 2019 07:22
Demo BlazeFace model.
import cv2
import time
import math
import numpy as np
import tensorflow as tf
class SsdAnchorsCalculatorOptions:
def __init__(self, input_size_width, input_size_height, min_scale, max_scale
, num_layers, feature_map_width, feature_map_height
, strides, aspect_ratios, anchor_offset_x=0.5, anchor_offset_y=0.5
@zhaokuohaha
zhaokuohaha / 微信公众号获取用户基本信息的方法总结.md
Last active March 26, 2024 16:16
包括:服务号, 订阅号, 开放平台 , 以及在各个场景下应选择何种方式获取等

背景: 折腾了一整个周末,终于把用通过微信进行获取用户信息,以用来进行账号注册登录的问题搞定了, 因为面对的问题比较棘手: 希望通过微信订阅号获取用户信息授权,在自己开放的网站(所谓第三方网站)拿到用户信息, 所以在解决问题的过程中,顺便把自己期望实现的方式,以及现有的方式也稍微了解了一些, 所以趁此机会做一个整理。 因为朋友的网站是 php 开发的,所以下面的代码会以 php 进行举例,尽管我对 php 并不熟悉, 但是现在懒得重新去实现一遍了, 后面再说吧, 如果有后面的话。 其实其他语言理论上可以很容易类比, 因为微信的这些接口都是 restful 的 http 接口。

概述

微信授权登陆, 从使用入口来说,主要是 PC 端网站, 移动端网站和 APP。 这里的“移动端网站”是指从微信浏览器打开的网站,如果从手机浏览器打开, 那么只能与PC端的授权方式一样(实际上操作很麻烦) 基本的授权方式如下:

  • PC 端网站: 打开一个二维码, 用户扫描二维码之后授权 -> 获取用户信息
  • APP: 点击授权后跳转到微信授权页面, 用户点击确认授权 -> 获取用户信息

以上两种方式基本可以通过微信开放平台实现。

@jsully1996
jsully1996 / PyTorch Basic GAN implementation
Created March 9, 2019 06:56
A basic GAN in Pytorch using ~150 lines of code. Forked from eriklindernoren.
import argparse
import os
import numpy as np
import math
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
@daniel-j
daniel-j / hdmvpgs.js
Last active February 8, 2024 09:27
HDMV/PGS subtitle Javascript parser
'use strict'
function HDMVPGS (ctx) {
this.ctx = ctx || document.createElement('canvas').getContext('2d')
this.lastVisibleSegment = null
this.segments = []
this.loaded = false
}
HDMVPGS.prototype.loadBuffer = function (arraybuffer) {
@gpchelkin
gpchelkin / dante_setup.sh
Last active August 22, 2023 06:45
How to Setup SOCKS5 Proxy Server for (not only) Telegram using Dante on Ubuntu 16.04 / 18.04 / 20.04
### NOT A SCRIPT, JUST A REFERENCE!
# install dante-server
sudo apt update
sudo apt install dante-server
# or download latest dante-server deb for Ubuntu, works for 16.04 / 18.04 / 20.04:
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/dante/dante-server_1.4.2+dfsg-7build5_amd64.deb
# or older version:
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb
@devinhyden
devinhyden / vuetifyjs-login.html
Last active March 26, 2021 08:14
Vuetifyjs Login Form
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet">
</head>
<style>
#app {
@hmldd
hmldd / scroll.py
Last active October 6, 2023 14:59
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"