Skip to content

Instantly share code, notes, and snippets.

View shuxiaokai's full-sized avatar
:octocat:

shuxiaokai

:octocat:
  • M78 Nebula
  • Mars
View GitHub Profile
@shuxiaokai
shuxiaokai / README.md
Created June 14, 2022 08:35 — forked from ZipFile/README.md
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@shuxiaokai
shuxiaokai / README.md
Created May 5, 2022 08:06 — forked from florimondmanca/README.md
HTTPX vs aiohttp (over HTTPS)

Usage

  • Generate TLS certificates for localhost:
pip install trustme-cli
trustme-cli
  • Run wrk on each endpoint, eg:
@shuxiaokai
shuxiaokai / google-speech-2-text-README.md
Created March 2, 2022 09:31 — forked from dannguyen/google-speech-2-text-README.md
How Google's text-to-speech API performs when reading the New York Times

Demo of Google text-to-speech Wavenet API on a NYT article

Was curious if Google's text-to-speech API might be good enough for generating audio versions of stories on-the-fly. Google has offered traditional computer voices for awhile, but last year made available their premium WaveNet voices, which are trained using audio recorded from human speakers, and are purportedly capable of mimicking natural-sounding inflection and rhythm.

tl;dr results

Pretty good...but I honestly can't tell the difference between the standard voice and the WaveNet version, at least when it comes to intonation and inflection. The first 2 grafs of this NYT story, roughly 85 words/560 characters, took less than 2 seconds to process. The result in both cases is a 37-second second audio file.

  • The M
@shuxiaokai
shuxiaokai / kernel.py
Created February 2, 2022 13:37 — forked from korakot/kernel.py
Install rust, cargo in Colab
# run this once, then reload, and then skip this
!apt install rustc
!gdown --id 1PULtTc-2e9z4bswh_SQqL5oy_4JpfV7c
!chmod +x evcxr_jupyter
!./evcxr_jupyter --install
// install dependency
:dep cmd_lib
use cmd_lib::run_cmd as sh;
@shuxiaokai
shuxiaokai / FastTelethon.py
Created January 29, 2022 11:50 — forked from painor/FastTelethon.py
This will increase the download/upload speed when using telethon
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py
# Copyright (C) 2021 Tulir Asokan
import asyncio
import hashlib
import inspect
import logging
import math
import os
from collections import defaultdict
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO
@shuxiaokai
shuxiaokai / xiaoxiao_tts.py
Created January 26, 2022 05:01 — forked from Lulalaby/xiaoxiao_tts.py
superb edit of an old parameterless script
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Edge Microsoft TTS for Python."""
import sys
from ws4py.client.threadedclient import WebSocketClient
import binascii
import argparse
import json
import requests
import re
@shuxiaokai
shuxiaokai / xiaoxiao_tts.py
Created January 26, 2022 05:01 — forked from xjohjrdy/xiaoxiao_tts.py
返回的音频没有文件头,所以我随便加的一个文件头,但显示的音频时长有问题。如果播放器不能正常播放,可以使用Chrome播放。
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from ws4py.client.threadedclient import WebSocketClient
import binascii
class WSClient(WebSocketClient):
def __init__(self, url, text, filename):
@shuxiaokai
shuxiaokai / xiaoxiao_tts.py
Created January 26, 2022 04:59 — forked from Dobby233Liu/xiaoxiao_tts.py
superb edit of an old parameterless script
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Edge Microsoft TTS for Python."""
import sys
from ws4py.client.threadedclient import WebSocketClient
import binascii
import argparse
import json
import requests
import re
@shuxiaokai
shuxiaokai / colab_xface_vnc.ipynb
Created January 23, 2022 19:28 — forked from ahmedengu/colab_xface_vnc.ipynb
Use google colab as a remote machine with the help of ngrok, vnc server and xface desktop you can change the configurations and desktop environment as you please it's just a start
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shuxiaokai
shuxiaokai / nginx-server.conf
Created January 23, 2022 06:42 — forked from zaru/nginx-server.conf
ngrok + nginx proxy (keep alive)
upstream http_backend {
server example.ngrok.io;
keepalive 128;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;