Skip to content

Instantly share code, notes, and snippets.

@terapyon
terapyon / make_subtitle.py
Last active June 30, 2023 22:38
Whisper sample script
from pathlib import Path
import whisper
from whisper.utils import get_writer
BASE = Path(__file__).parent
def main(folder: Path, ext: str = "wav", lang: str = "Japanese", model_name: str = "large-v2"):
model = whisper.load_model(model_name)
@terapyon
terapyon / po2csv.py
Created July 19, 2019 10:07
Plone po file to csv file
"""
po file to CSV file for untranselated
"""
from collections import defaultdict
import csv
EMPTY_ONLY = True
CSV_HEADERS = ("uses", "default", "msgid", "fuzzy", "msgstr")
@terapyon
terapyon / get_course.py
Created August 22, 2018 16:00
aiohttpの勉強で、 logファイルから必要な情報(内部はJSON)を取得する例
import json
import gzip
from operator import itemgetter
from pathlib import Path
import asyncio
def get_logfiles(path):
for p in path.glob("*.gz"):
date_str = p.stem.split('-')[1]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terapyon
terapyon / pyhack-camp-manual.md
Last active January 15, 2022 13:27
pyhack合宿マニュアル

概要

  • 年に2回実施している、pyhack合宿の説明文書
  • 貸し切りで開催を前提にしている

施設・設備

インターネット回線

  • 宿にはBフレッツ光回線
@terapyon
terapyon / IcecreamSalesCorr.ipynb
Last active February 23, 2018 11:24
アイスクリーム売上相関
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terapyon
terapyon / SciPyTutorial.ipynb
Created January 1, 2018 08:38
SciPy で 線形代数を扱う
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@terapyon
terapyon / aes_decrypt.py
Created November 29, 2017 02:08
AES PHP to Python
import binascii
from Crypto.Cipher import AES
data = "abcdefghijklmnopqrstuvwxyz"
key = "pqrstuvwxyz$abcdefghijAB"
iv = "DEFGHTABCIESPQXO"
encrypted = "2324ab5ec7a901247bf01b08bd1956688843dad5a8e15106ca3a5b9258918527"
cipher = AES.new(key, AES.MODE_CBC, iv)
import b
class A:
def __init__(self, save_dir):
self.save_dir = save_dir
save_dialog = A(b.prefs.get('save_dir'))
def show():
pass
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.