Skip to content

Instantly share code, notes, and snippets.

@autch
autch / getloop.c
Created September 28, 2021 03:52
CSTMのループ情報を LOOPSTART/LOOPLENGTH に変換して出力
#include <stdio.h>
#include <stdint.h>
// reference: https://www.3dbrew.org/wiki/BCSTM
#define CSTM_SIGNATURE 'MTSC'
#define CSTM_LITTLE_ENDIAN 0xfeff
#define CSTM_REF_TYPE_INFO 0x4000
@autch
autch / encode.py
Last active May 6, 2025 17:08
VRChat で連写した画像をまとめて動画にする、要 FFmpeg
#!/usr/bin/env python
import argparse
import subprocess
import glob
FFMPEG = ["ffmpeg", "-hide_banner", "-y",
"-f", "concat",
("-r", lambda args: str(args.fps)),
("-i", lambda args: args.input),
@autch
autch / convert_pano.py
Last active September 8, 2021 07:24
VRChat の Panorama Camera で撮影したステレオ 360° 画像を左目と右目に分離して保存、それぞれに 360 photo の XMP メタデータを付与する
import argparse
import datetime
import os
import re
import xml.etree.ElementTree as ET
from pathlib import Path
from multiprocessing import Queue, Process, freeze_support
from PIL import Image # pip install Pillow
from PIL.PngImagePlugin import PngInfo
@autch
autch / rump1988.py
Last active April 23, 2021 06:11
Rump's example
from decimal import *
# Siegfried M. Rump (1988),
# “Algorithms for Verified Inclusions: Theory and Practice,”,
# in R. E. Moore, Reliability in Computing: The Role of Interval Methods in Scientific Computing,
# Boston: Academic Press, pp. 109-126., doi:10.15480/882.316
def f(a, b):
return (333.75*(b**6)) + (a**2)*(11*(a**2)*(b**2) - (b**6) - (121*(b**4)) - 2) + (5.5*(b**8)) + (a / (2*b))
@autch
autch / show_cred.py
Created September 14, 2020 01:44
show AWS credentials from standard configuration
#!/usr/bin/env python
import boto3
session = boto3.Session()
cred = session.get_credentials().get_frozen_credentials()
env = {
'AWS_PROFILE': session.profile_name,
'AWS_DEFAULT_REGION': session.region_name,
@autch
autch / gist:ef1386297d67d2c86e80792117778a8c
Created May 8, 2020 16:57
certificate of 35.241.52.229 is expired, note that subject L=Copenhagen (valid one says L=Koebenhavn)
$ openssl s_client -connect 35.241.52.229:443
CONNECTED(00000003)
Can't use SSL_get_servername
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify return:1
depth=0 C = DK, L = Copenhagen, O = Unity Technologies ApS, CN = *.unity3d.com
verify error:num=10:certificate has expired
notAfter=May 8 12:00:00 2020 GMT
@autch
autch / filter.js
Created December 18, 2019 15:26
Twitterでフォローしているアカウントのうち、まだWebカタログでお気にしてないアカウントを抽出
const fs = require('fs');
// https://app.ecocorogy.com/eventlist/ から落とせる「完了ファイル」
const friendsList = JSON.parse(fs.readFileSync('friendslist.txt', {encoding: 'utf8'}));
// https://webcatalog.circle.ms/User/Twitter から落とせる「お気に入りアカウント一覧」
const comikeFavAccountList = fs.readFileSync('comikeFavAccount.txt', {encoding: 'utf8'}).split(/\r?\n/);
// https://app.ecocorogy.com/eventlist/ の結果から以下の bookmarklet で得られる JSON
// JSON.stringify(Array.from(document.querySelectorAll('div[userid]'), i => i.getAttribute('userid')))
const detectedAccountList = JSON.parse(fs.readFileSync('detected_accounts.json', {encoding: 'utf8'}));
@autch
autch / ffmpeg_stream.sh
Created December 5, 2019 01:31
FFmpeg で HLS/DASH 同時ストリーミング
#!/bin/sh
OUTDIR=/tmp/radio
rm -rf ${OUTDIR}/*/
mkdir -p ${OUTDIR}/hls/ ${OUTDIR}/dash/
HLS_CMD="[select=\'0:a\':f=segment:segment_format=mpegts:segment_time=10:segment_wrap=6:segment_list_flags=live:segment_list=${OUTDIR}/hls/radio.m3u8]${OUTDIR}/hls/radio.%04d.ts"
DASH_CMD="[select=\'0:a\':f=dash:seg_duration=10:hls_playlist=1:streaming=1]${OUTDIR}/dash/radio.mpd"
@autch
autch / gist:d671e7e7cde8320320c9227266419043
Created October 23, 2019 02:44
SHA256 をファイル名に使える Base64 エンコード
ruby -rdigest/sha2 -rbase64 -e "puts Base64.urlsafe_encode64(Digest::SHA256.file(ARGV.shift).digest)" -- foo.file
@autch
autch / raspi_temp.c
Created February 21, 2019 06:58
gcc -g -Wall -o raspi_temp raspi_temp.c && sudo cp raspi_temp /etc/munin/plugins/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TEMP_PATH "/sys/class/thermal/thermal_zone0/temp"
#define BUFFER_SIZE (1024)
int main(int ac, char **av)
{