Skip to content

Instantly share code, notes, and snippets.

View leeyisoft's full-sized avatar
🏠
Working from home

leeyi leeyisoft

🏠
Working from home
View GitHub Profile
@leeyisoft
leeyisoft / docker-registry-mirrors.md
Created June 17, 2024 00:49 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@leeyisoft
leeyisoft / multipart-upload.erl
Created May 31, 2023 10:19 — forked from ArthurClemens/multipart-upload.erl
Erlang: upload data using multipart/form-data
%% Usage:
%% upload_request(<<"site.com/api/upload">>, <<"path/to/file.png">>, <<"upload">>, <<"image/png">>, [], <<"some-token">>)
%%
%% Usage with RequestData:
%% Payload = [{upload_type, <<"user_picture">>}],
%% PayloadContent = jsx:encode(Payload),
%% RequestData = [
%% {<<"payload">>, PayloadContent}
%% ]
%% upload_request(<<"site.com/api/upload">>, <<"path/to/file.png">>, <<"upload">>, <<"image/png">>, RequestData, <<"some-token">>)
@leeyisoft
leeyisoft / gist:9037c64d3ff97a851a17eae2c90c9c8d
Created November 25, 2022 10:50
Perfect negotiation with Flutter-WebRTC
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:vpl_frontend/calls/ws_messages.dart';
import 'package:vpl_frontend/utils/api.dart';
import 'call_manager_base.dart';
class RtcConnection {
MediaStream _localStream;
RTCPeerConnection _peerConnection;
RTCVideoRenderer _localRenderer = RTCVideoRenderer();
@leeyisoft
leeyisoft / timing_wheel.erl
Created June 10, 2020 11:36 — forked from zhongwencool/timing_wheel.erl
一个简单的分层时间轮实现:类似于3维数组实现时钟
%%%-------------------------------------------------------------------
%%% @author zhongwencool@gmail.com
%%% @doc 一个简单的分层时间轮实现:类似于3维数组实现时钟
%%% 根据 http://www.embeddedlinux.org.cn/RTConforEmbSys/5107final/LiB0071.html 实现
%%% 1.时钟原理说明:
%%% 1.1. 初始化一个三层时间轮:秒刻盘:0~59个SecList, 分刻盘:0~59个MinList, 时刻盘:0~12个HourList;
%%% 1.2. SecTick由外界推动,每跳一轮(60格),SecTick复位至0,同时MinTick跳1格;
%%% 1.3. 同理MinTick每跳一轮(60格),MinTick复位至0,同时HourTick跳1格;
%%% 1.4. 最高层:HourTick跳一轮(12格),HourTick复位至0,一个时间轮完整周期完成.
%%% 2.事件原理说明:
@leeyisoft
leeyisoft / client5.c
Created June 6, 2020 22:13 — forked from yongboy/client5.c
just add http header attribute
#include <sys/types.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <stdlib.h>
#include <err.h>
#include <event.h>
#include <evhttp.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>