Skip to content

Instantly share code, notes, and snippets.

View castaneai's full-sized avatar
🥳
Watching anime

castaneai castaneai

🥳
Watching anime
View GitHub Profile
@castaneai
castaneai / utime.py
Created April 11, 2018 14:14
for migrating screenshots
import os
import glob
import datetime
import shutil
datetime_formats = [
'%Y_%m_%d_%H_%M_%S',
'%Y_%m_%d_%H'
]
@castaneai
castaneai / _mp4_parser_go.md
Last active July 4, 2020 10:50
mp4 parsing
@castaneai
castaneai / crista.py
Created January 11, 2018 17:48
clip studio paint -> png
import sqlite3
data = open('test.clip', 'rb').read()
sqlite_head = data.index(b'SQLite format 3')
with open('test.sqlite3', 'wb') as dbf:
dbf.write(data[sqlite_head:])
sqlite = sqlite3.connect('test.sqlite3')
image_data = sqlite.execute('select ImageData from CanvasPreview').fetchone()[0]
with open('test.png', 'wb') as imf:
imf.write(image_data)
@castaneai
castaneai / .htaccess
Last active December 11, 2017 11:37
seccon 2017 予選 スクリプトたち
<FilesMatch "\.test$">
SetHandler application/x-httpd-php
</FilesMatch>
@castaneai
castaneai / bench.py
Created September 9, 2017 17:44
srv bench
import time
import struct
import socket
from server import _recvall
NUM_CLIENT = 1
socks = []
for i in range(NUM_CLIENT):
sock = socket.socket()
@castaneai
castaneai / crossfade.html
Created September 9, 2017 17:31
Audio crossfade example (HTML)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Crossfade Demo</title>
<style>
html, body {
margin: 0;
@castaneai
castaneai / crossfade.html
Created September 9, 2017 17:25
Audio crossfade example with Web Audio API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Crossfade Demo</title>
<style>
html, body {
margin: 0;
@castaneai
castaneai / im.py
Created February 28, 2017 16:32
cv2
def imread_yazo(filename, flag):
with open(filename, "rb") as f:
return cv2.imdecode(f.read(), flag)
def imwrite_yazo(filename, img, flag):
with open(filename, "wb") as f:
ext = os.path.splitext(filename)[1]
f.write(cv2.imencode(ext, img, flag))
@castaneai
castaneai / program0817.cs
Last active August 16, 2016 18:07
program 0817
using System;
using System.Collections;
using System.Linq;
class Program0817
{
static void Main(string[] args)
{
var data = new byte[]
{
@castaneai
castaneai / is_yokosama.py
Created May 30, 2016 11:27
こんにちは、園部篠と申します。西川家の元メイドです。PythonのOpenCVバインディング、numpyの配列、HSVによる色範囲抽出、三者三葉のライブラリ、ほんと素敵ですよね。お聞きください。「画像内に葉子様がいらっしゃるか判別するプログラム」、じゃんけんぽん。
import cv2
import numpy as np
files = [
"input01.jpg",
"not01.jpg",
"input02.jpg",
"not02.jpg",
"input03.jpg",
"not03.jpg",