Skip to content

Instantly share code, notes, and snippets.

View wanghaisheng's full-sized avatar
🏠
got a covid like heavy fever for the last days

HeisenBerg? wanghaisheng

🏠
got a covid like heavy fever for the last days
View GitHub Profile
@wanghaisheng
wanghaisheng / build_flask_.sh
Created May 8, 2022 12:39 — forked from mrf345/build_flask_.sh
Building one-file executable for Python Flask using Pyinstaller
#!/bin/bash
pyinstaller -F -w \
--hidden-import='email.mime.multipart' \
--hidden-import='email.mime.message' \
--hidden-import='email.mime.text' \
--hidden-import='email.mime.image' \
--hidden-import='email.mime.audio' \
--hidden-import='sqlalchemy.sql.default_comparator' \
--hidden-import='jinja2' \
main.py
@wanghaisheng
wanghaisheng / ffmpeg.md
Created May 18, 2022 08:00 — forked from protrolium/ffmpeg.md
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@wanghaisheng
wanghaisheng / autotranslate_hardsubs.py
Created July 15, 2023 05:06 — forked from kumorikuma/autotranslate_hardsubs.py
Takes as input a video with hardsubs, and will generate translated softsubs in the target language
# Requirements:
# - ImageMagick binary
# - Windows.Media.Ocr.Cli binary
# - VideoSubFinder binary
#
# Official GCloud Translate Setup:
# First 500k characters / mo is free: https://cloud.google.com/translate/pricing
# Install Python Module: pip install google-cloud-translate
# Setup Google Cloud account and billing information: https://cloud.google.com/
# Make a new project and enable "Cloud Translation API": https://console.cloud.google.com/apis/dashboard
@wanghaisheng
wanghaisheng / custom-log-filtering-and-formatting.py
Created October 28, 2023 15:14 — forked from acdha/custom-log-filtering-and-formatting.py
Example of how to filter or apply custom formatting using Python's logging library
#!/usr/bin/env python
# encoding: utf-8
from pprint import pformat, pprint
import logging
class PasswordMaskingFilter(logging.Filter):
"""Demonstrate how to filter sensitive data:"""
@wanghaisheng
wanghaisheng / 01-mac-profiling.md
Created December 18, 2023 11:18 — forked from loderunner/01-mac-profiling.md
Profiling an application in Mac OS X

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity: