This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
JPEG encoder based on gstreamer. | |
Many thanks to the following code and docs: | |
- The usage of `appsrc` in Python: https://github.com/tamaggo/gstreamer-examples/blob/master/test_gst_appsrc_testvideo_mp4mux.py | |
- The usage of `appsink` in Python: https://gist.github.com/willpatera/7984486 | |
- The usage of both `appsrc` and `appsink` in C++: https://github.com/dkorobkov/gstreamer-appsrc-appsink-example/blob/master/JpegGstEncoder.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseEncoder: | |
""" | |
An encoder that can encode a decimal number to a string in any base, and vice versa. | |
Example usage: | |
>>> import string | |
>>> chars_62 = string.digits + string.ascii_letters[:52] | |
>>> encoder = BaseEncoder(chars_62) | |
>>> encoder.encode(10765432100123456789) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package httpclient | |
import ( | |
"net" | |
"net/http" | |
"time" | |
) | |
// Options includes common Client configurations that need to be tuned. | |
type Options struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package werror | |
import ( | |
"fmt" | |
) | |
type Error struct { | |
Err error // the underlying error | |
Str string | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"net/http" | |
"github.com/RussellLuo/appx" | |
"github.com/gin-gonic/gin" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Write request and response data to a JSONL file. | |
This script demonstrates how to capture HTTP request and response data and write them | |
to a JSONL (JSON Lines) file format. Each request-response pair is written as a | |
single JSON object on its own line, making it easy to process complete HTTP flow data. | |
""" | |
import json | |
import os |
OlderNewer