Skip to content

Instantly share code, notes, and snippets.

View duyuxuan's full-sized avatar
🎯
Focusing

杜育轩 duyuxuan

🎯
Focusing
View GitHub Profile
@duyuxuan
duyuxuan / cloudflare-worker-proxy.js
Created February 15, 2024 02:53 — 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.
@duyuxuan
duyuxuan / example.py
Created June 24, 2022 06:47 — forked from 1st1/example.py
asyncio queues example
import asyncio
import random
import time
async def worker(name, queue):
while True:
# Get a "work item" out of the queue.
sleep_for = await queue.get()
@duyuxuan
duyuxuan / app.py
Created June 6, 2022 07:13 — forked from tombulled/app.py
Stream a file, in this case an mp4 video, supporting range-requests using starlette
from starlette.applications import Starlette
from starlette.responses import StreamingResponse
from starlette.requests import Request
from starlette.routing import Route
from pathlib import Path
from typing import IO, Generator
"""
Stream a file, in this case an mp4 video, supporting range-requests using starlette
@duyuxuan
duyuxuan / BroadcastReceiver.kt
Created February 20, 2022 13:51 — forked from gpeal/BroadcastReceiver.kt
Coroutine Broadcast Receivers
context.registerReceiverInScope(scope, WifiManager.WIFI_STATE_CHANGED_ACTION) { intent ->
val state = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED)
// Use wifi state here
}
/**
* Register a broadcast receiver in the given coroutine scope for any of the specified actions
* and call the callback when it is invoked.
*/
fun Context.registerReceiverInScope(
@duyuxuan
duyuxuan / ZoomLayout.java
Created February 9, 2022 05:05 — forked from anorth/ZoomLayout.java
Pinch-zoomable Android frame layout
package au.id.alexn;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.FrameLayout;
@duyuxuan
duyuxuan / main.py
Created October 20, 2021 06:19 — forked from takidog/main.py
push RTSP stream with ffmpeg by python
import cv2
import subprocess as sp
if __name__ == "__main__":
rtsp_server = 'rtsp://example.org:554/...' # push server (output server)
#pull rtsp data, or your cv cap. (input server)
cap = cv2.VideoCapture(
'rtsp://example.org:554/pull from me ')
@duyuxuan
duyuxuan / docker-compose.yml
Created August 26, 2021 10:22 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@duyuxuan
duyuxuan / ffmpeg.md
Created May 21, 2021 00:55 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
@duyuxuan
duyuxuan / mqtt.rst
Created November 27, 2019 04:52 — forked from voluntas/mqtt.rst
MQTT とはなんだったのか

MQTT とはなんだったのか

更新

2017-05-09

作者

@voluntas

バージョン

3.14

URL

http://voluntas.github.io/

MQTT をググって調べた人向け

@duyuxuan
duyuxuan / diag.md
Created August 1, 2018 07:09 — forked from hashrock/diag.md
作図系ツール・ライブラリまとめ

シーケンス図とかフローチャートをしごとで描画することになった場合、 テキストから生成できたら楽なので、それ系のツールまとめ

GraphViz

http://www.graphviz.org/

  • C製
  • Doxygen, Moinmoinなどと連携可能
  • ブロック図、クラス図、ネットワーク図など