Skip to content

Instantly share code, notes, and snippets.

View maltoze's full-sized avatar

maltoze maltoze

  • China
  • 12:15 (UTC +08:00)
View GitHub Profile
#!/usr/bin/env bash
# Metadata allows your plugin to show up in the app, and website.
#
# <xbar.title>FLT/USDT tracker</xbar.title>
# <xbar.version>v0.1</xbar.version>
# <xbar.author>maltoze</xbar.author>
# <xbar.author.github>maltoze</xbar.author.github>
# <xbar.desc>FLT/USDT price tracker</xbar.desc>
# <xbar.image></xbar.image>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
function mkssml(text, voice, rate, volume) {
return (
"<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" +
`<voice name='${voice}'><prosody pitch='+0Hz' rate='${rate}' volume='${volume}'>` +
`${text}</prosody></voice></speak>`
)
}
function ssmlHeadersPlusData(request_id, timestamp, ssml) {
return (
`X-RequestId:${request_id}\r\n` +
import ctypes
import logging
import signal
import sys
def main():
lib = ctypes.cdll.LoadLibrary(
"./bazel-bin/mediapipe/examples/desktop/object_detection_dll/object_detection_cpu.dll"
)
@maltoze
maltoze / django_http_streaming.py
Last active June 27, 2022 02:24
django http streaming(chunked) response
# django-views.py
def test_iter():
for i in range(5000):
yield i
def health(request):
return StreamingHttpResponse(test_iter())
import { useEffect, useRef } from 'preact/hooks';
import { Cord } from 'src/types';
const QuadsDrawableCanvas = () => {
const canvasRef = useRef<HTMLCanvasElement>();
const cordArrRef = useRef<Cord[]>([]);
const initSizeRef = useRef<boolean>(false);
const handleCanvasMouseDown = (e: MouseEvent) => {
e.preventDefault();
@maltoze
maltoze / list_to_tree_dict.py
Last active December 11, 2019 03:27
Convert list to tree like list structure https://stackoverflow.com/questions/49853041/
def tree_to_format(tree):
ret = []
for k in tree:
ret.append({'name': k, 'children': tree_to_format(tree[k])})
return ret
def items_to_tree(items):
dic = {}
for parts in items:
cursor = dic

Keybase proof

I hereby claim:

  • I am maltoze on github.
  • I am maltoze (https://keybase.io/maltoze) on keybase.
  • I have a public key ASDj02A8LFCBtkfcmsmRou-5nx5QqtO9DRCaKpcuB8qW9go

To claim this, I am signing this object:

@maltoze
maltoze / rsync-exclude-gitignore.sh
Created November 13, 2019 04:17
rsync exclude .gitignore files
git -C superset ls-files --exclude-standard -oi --directory > .git/ignores.tmp && echo.git/ignores.tmp
rsync -azP --delete --exclude-from .git/ignores.tmp SRC DEST
# -*- coding: utf-8 -*-
"""
两个功能:
1:保存微信群聊天信息(文本和图片信息)
2: 对话以'twr'开始时自动调用聊天机器人小黄鸡
致谢:
https://github.com/0x5e/wechat-deleted-friends
http://www.tanhao.me/talk/1466.html
"""