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 / .clang-format
Last active April 7, 2024 06:49 — forked from pganssle/.clang-format
Clang format style that approximates PEP 7
# Forked from https://gist.github.com/pganssle/0e3a5f828b4d07d79447f6ced8e7e4db
# Licensed under MIT License which the author permits to release with.
# Copyright 2024 Takumi Sueda
# Copyright 2019 Paul Ganssle
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: Google
AlwaysBreakAfterReturnType: AllDefinitions
AllowShortIfStatementsOnASingleLine: false
@puhitaku
puhitaku / okayama_health_tourism_scraper.py
Last active October 18, 2023 19:37
Scraper of the list of Muslim-friendly restaurants on Okayama Health Tourism / Okayama City
'''
This script scrapes okayamahealthtourism.com/food/okayama-city/ and
gathers all restaurants' name and address.
The result will be printed out to the stdout. Redirect the stderr
if you find it annoying.
The result will need some hand-picking and hand-cleansing.
While I've never confirmed, this will work for Maniwa City page.
@puhitaku
puhitaku / gadget.sh
Created May 24, 2023 21:56
Setup RNDIS gadget on SHARP Brain
#!/bin/sh
g=/sys/kernel/config/usb_gadget/eth
mkdir ${g}
echo "0x3066" > ${g}/bcdDevice
echo "1" > ${g}/os_desc/use
echo "0xcd" > ${g}/os_desc/b_vendor_code
echo "MSFT100" > ${g}/os_desc/qw_sign
@puhitaku
puhitaku / slack_archive_emoji_counter.py
Created March 14, 2023 15:46
Slack Archive Emoji Counter
"""
Slack Archive Emoji Counter
Copyright (c) 2023 Takumi Sueda (puhitaku@gmail.com)
SPDX-License-Identifier: MIT
Put this script by the channel directories and run it.
"""
import json
import sys
@puhitaku
puhitaku / hksneidn.py
Created March 6, 2023 12:10
HKSNEIDN watcher
import time
from datetime import datetime
from email.utils import parsedate
# pip install requests
import requests
last = None
@puhitaku
puhitaku / register-qemu-arm.sh
Created March 1, 2023 17:20
Register qemu-arm-static to the running Linux kernel
#!/bin/sh
if [ -e /proc/sys/fs/binfmt_misc/qemu-arm ]; then
echo "qemu-arm is already registered to binfmt_misc."
exit 1
fi
# Ref: https://docs.kernel.org/admin-guide/binfmt-misc.html
NAME='qemu-arm'
TYPE='M'
@puhitaku
puhitaku / main.py
Created January 26, 2023 14:05
Fetch available icecreams from Tokaido Shinkansen and Sanyo Shinkansen
import requests as req
from bs4 import BeautifulSoup
def scrape_tokai() -> list[tuple]:
res = req.get('https://www.jr-cp.co.jp/wp-json/wp/v2/services?per_page=100&services_category=21')
j = res.json()
return [(item['title']['rendered'], item['data']['price_services']) for item in res.json()]
@puhitaku
puhitaku / requirements.txt
Created January 26, 2023 14:04
Fetch available icecreams from Tokaido Shinkansen and Sanyo Shinkansen
import requests as req
from bs4 import BeautifulSoup
def scrape_tokai() -> list[tuple]:
res = req.get('https://www.jr-cp.co.jp/wp-json/wp/v2/services?per_page=100&services_category=21')
j = res.json()
return [(item['title']['rendered'], item['data']['price_services']) for item in res.json()]
@puhitaku
puhitaku / bootlog.log
Created March 20, 2022 06:39
SB-WR03-WICR Bootlog
U-Boot 1.1.3 (Oct 3 2014 - 14:23:51)
Board: Ralink APSoC DRAM: 64 MB
relocate_code Pointer at: 83fb4000
enable ephy clock...done. rf reg 29 = 5
SSC disabled.
spi_wait_nsec: 29
spi device id: ef 40 18 0 0 (40180000)
@puhitaku
puhitaku / _.md
Last active January 21, 2022 19:56
私立PDD図書館・百科辞書を Web API にするやつ

使い方

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

.
├── api.py
├── a
│   ├── あ
│   ├── い
│   ├── う