Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# (C) Copyright 2022 hhsprings, https://github.com/hhsprings
# SPDX-License-Identifier: MIT
import io
import os
import sys
import shutil
import re
import urllib.request
from collections import defaultdict
@hhsprings
hhsprings / using_voicevoxengine_example.py
Last active December 8, 2022 19:17
VOICEVOX エンジンを python から使いたいの。のはじめのいっぽ。
# -*- coding: utf-8 -*-
"""
using VOICEVOX Engine on docker
https://github.com/VOICEVOX/voicevox_engine#docker-%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8
"""
import io
import os
import json
import base64
import urllib
@hhsprings
hhsprings / Dockerfile-ffmpeg_custombuilt
Last active May 31, 2022 17:49
This is a Dockerfile configured to build FFMPEG on its own, independent of apt-get. (This is an original version of https://github.com/hhsprings/docker-ffmpeg-yours)
#
ARG _BUILDPACKDEPS_TAG=22.04
FROM hhsprings/buildpack-deps-plus:latest-from-${_BUILDPACKDEPS_TAG}
ARG _FFMPEG_VERSION=4.4.2
ARG _OPENCV_VERSION=3.4.15
ARG _PREFIX=/usr/local
ARG _FFMPEG_EXTRA_VERSION_SUFFIX=hhsprings0.1
ARG __APT_Y="-yq --no-install-recommends"
#
WORKDIR /tmp/build
@hhsprings
hhsprings / make_yt_mylocalplaylist.py
Last active May 18, 2022 13:23
Import a youtube playlist and make it your local html.
# -*- coding: utf-8 -*-
import io
import json
import re
import sys
import os
from urllib.request import urlretrieve
from urllib.request import unquote, quote
import bs4
@hhsprings
hhsprings / ffaddmeta.py
Last active June 5, 2022 17:44
To add "ffmetadata1" to video
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import io
import os
import re
import sys
import subprocess
import tempfile
@hhsprings
hhsprings / tempcleango.go
Last active March 20, 2023 20:20
clean-up files in temporary directory, written by Golang
package main
import (
"os"
"io"
"io/fs"
"fmt"
"log"
"time"
"bytes"
@hhsprings
hhsprings / rmdirhier.go
Last active February 27, 2022 06:37
remove empty directories, written by Golang
package main
import (
"os"
"log"
"sort"
"strings"
"path/filepath"
)
@hhsprings
hhsprings / exemimicry.go
Last active March 13, 2022 01:53
A program that mimics the target application (EXE) on Windows. It is supposed to be used by hard linking with the same name as the target application.
package main
import (
"io"
"os"
"os/exec"
"text/template"
"bytes"
"strings"
"regexp"
@hhsprings
hhsprings / zip2tar.go
Last active March 23, 2022 14:03
unpacking/repacking zip written by Golang
package main
import (
"archive/zip"
"archive/tar"
"compress/gzip"
//"compress/bzip2" // bzip2 package of standard library in Go 1.16 has no compression ability.
"github.com/dsnet/compress/bzip2"
"fmt"
"io"
@hhsprings
hhsprings / zip2tar.py
Last active January 24, 2022 00:49
convert zip to other
#! py -3
# -*- coding: utf-8 -*-
import sys
import os
import tarfile
import zipfile
import calendar
import datetime
import getpass
from io import BytesIO