Skip to content

Instantly share code, notes, and snippets.

View kevinzhow's full-sized avatar
🏠
正在搬砖

Kevin kevinzhow

🏠
正在搬砖
View GitHub Profile
@Fhrozen
Fhrozen / convert_tts2onnx.py
Last active April 8, 2024 10:04
Routine to generate an ONNX model for ESPnet 2 - Text2Speech model
#!/usr/bin/env python3
"""Convert TTS to ONNX
Using ESPnet.
Test command:
python convert_tts2onnx.py --tts-tag espnet/kan-bayashi_ljspeech_vits
"""
import argparse
import logging
@otmb
otmb / example.py
Created April 16, 2021 09:20
OpenVINO 日本語手書き文字認識 to TensorflowLite model test
import sys
import cv2
import numpy as np
import tensorflow as tf
def preprocess_input(image_name, height, width):
src = cv2.imread(image_name, cv2.IMREAD_GRAYSCALE)
ratio = float(src.shape[1]) / float(src.shape[0])
tw = int(height * ratio)
rsz = cv2.resize(src, (tw, height), interpolation=cv2.INTER_AREA).astype(np.float32)
@kh4zad
kh4zad / GZIPEncoding.swift
Last active September 16, 2021 06:27
GZIP encoding for Alamofire requests
import Alamofire
import Gzip // using https://github.com/1024jp/GzipSwift
public struct GZIPEncoding: ParameterEncoding {
public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {
var request = try urlRequest.asURLRequest()
guard let parameters = parameters else { return request }
@rsgalloway
rsgalloway / abcbuild.csh
Last active August 20, 2019 07:45
Alembic OSX Build
# tool chain
xcode-select --install
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# required libs
brew doctor
brew install boost --with-python
brew install boost-python
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@kendellfab
kendellfab / goto-sublime
Created August 1, 2013 20:53
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
@shellexy
shellexy / pygirconsole.py
Created November 15, 2011 12:38
提供 PyGtk3 的交互 shell
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- Mode: python; c-basic-offset: 4 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
'''Interactive Python Gir (Gtk3) Console
@author: Jiahua Huang <jhuangjiahua@gmail.com>
@license: LGPLv3+
'''