Skip to content

Instantly share code, notes, and snippets.

View puhitaku's full-sized avatar
:octocat:
= 🐙 + 🐱

Takumi Sueda puhitaku

:octocat:
= 🐙 + 🐱
View GitHub Profile
@puhitaku
puhitaku / _.md
Last active January 21, 2022 19:56
私立PDD図書館・百科辞書を Web API にするやつ

使い方

私立PDD図書館・百科辞書のLZHファイルをapi.pyと同じディレクトリに置いて展開し、以下のような配置にしてください。

.
├── api.py
├── a
│   ├── あ
│   ├── い
│   ├── う
@puhitaku
puhitaku / newbrainwatch.py
Last active January 15, 2023 07:22
SHARP Brain の新機種を見つけたら Discord に投げる bot
import io
import json
import os
import re
import sys
import time
from datetime import datetime
import requests as req
from PIL import Image, ImageDraw, ImageFont
@puhitaku
puhitaku / chouseichan
Last active December 5, 2021 08:07
Chousei-chan: 調整さんの日付一覧を生成するスクリプト
#!/usr/bin/env python3
"""
Chousei-chan: 調整さんの日付一覧を生成するスクリプト
# 必要なもの
- Python 3.9 以上
- Click (pip で入れてください)
import time
from datetime import datetime
from email.utils import parsedate
# pip install requests beautifulsoup4
import requests
from bs4 import BeautifulSoup as BS
last = None
@puhitaku
puhitaku / cmake.sh
Created February 15, 2021 16:28
Install OpenCV on Debian w/ pyenv
ROOT=~/.pyenv/versions/3.9.1
VENV_ROOT=$ROOT
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$VENV_ROOT \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D BUILD_opencv_java=OFF \
-D BUILD_opencv_python2=OFF \
@puhitaku
puhitaku / fontify.py
Last active February 12, 2021 13:52
Unicode special character converter
#!/usr/bin/env python3
import fileinput, sys
from dataclasses import dataclass
@dataclass
class Style:
start: int
patch: dict
import time
from datetime import datetime
from email.utils import parsedate
import requests
last = None
while True:
// From: https://stackoverflow.com/questions/12040303/how-to-access-physical-addresses-from-user-space-in-linux
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc < 3) {
@puhitaku
puhitaku / moji_emoji_stroke.py
Created November 5, 2020 09:49
透明背景に黒一色なPNG文字絵文字をちょっと縮小して白フチ付けるやつ
# Runs on Python 3.8 + Pillow
# Should run also on Python 3.7+
from pathlib import Path
from PIL import Image, ImageOps, ImageFilter
def main():
Path('./stroked').mkdir(exist_ok=True)
#!/usr/bin/env python3
# atsumorizer - resize and posterize square image into ACNH-compatible one
import json
import click
from more_itertools import collapse
from PIL import Image, ImageDraw, ImageFont