Skip to content

Instantly share code, notes, and snippets.

View MaverickTse's full-sized avatar

MaverickTse MaverickTse

View GitHub Profile
@MaverickTse
MaverickTse / doujin_pub.md
Last active September 23, 2017 02:35
work division on doujin publication in Japan

在日本出版同人的分工

一般流程總覽

生產方

  1. 作畫 (Roy)
  2. 翻譯 (MT)
  3. 按平台格式要求修正 (Roy, MT)
  4. 將文件及說明交給日方登記及上傳
  5. [若是實體物] 支付生產費予日方 (Roy, Ken)
@MaverickTse
MaverickTse / rec.ps1
Created September 22, 2017 07:26
Webcam recording using FFmpeg(need zeranoe or with text/font libs included)
cd "D:\ffmpeg-z"
./ffmpeg.exe -y -s 640x480 -framerate 25 -rtbufsize 100MB -f dshow -i video="Logitech HD Webcam C525":audio="Microphone (HD Webcam C525)" -vf "drawtext=expansion=strftime:fontfile=arial.ttf:text='%a %d\.%m\.%Y / %H\:%M\:%S':x=10:y=10:fontcolor=white: box=1: boxcolor=0x00000000@0.7" -vcodec h264 -acodec aac -t 00:58:00 $("D:/"+(Get-Date -UFormat "%Y%m%d%-%H%M").ToString()+".mp4")
@MaverickTse
MaverickTse / volscan.py
Created September 22, 2017 07:19
Scan a mono 16bit signed PCM wave file for sound level exceeding certain threshold
import os
import numpy as np
import argparse
import scipy.io.wavfile as w
def GetHMS(total_seconds:int):
hr = np.floor(total_seconds/3600)
q1 = total_seconds % 3600
m = np.floor(q1/60)
@MaverickTse
MaverickTse / extract_audio.ps1
Created September 22, 2017 07:15
PowerShell script to extract audio using FFmpeg. Down-mixing to mono
param(
[Parameter(Mandatory=$true)][string]$folder
)
if ($folder){
cd $folder
$filelist= Get-ChildItem -Path $folder -Name -Include *.mp4
Write-Output $filelist
ForEach ($f in $filelist){
$bname = (Get-Item $f).BaseName
@MaverickTse
MaverickTse / render_length_estimate.html
Created August 16, 2017 01:55
Estimate rendered length of a string in SVG and HTML5 canvas
<!DOCTYPE HTML>
<html>
<head>
<meta lang="en-us" encoding="utf-8"/>
<title>Canvas Test</title>
<script>
function check_txt_length()
{
var txt = document.getElementById("sample").value;
var cv = document.createElement("canvas");
@MaverickTse
MaverickTse / jpmynum_checkdigit_avx.cpp
Last active April 8, 2017 08:32
Calculating Japan's My Number check digit using AVX intrinsics
#include <string>
#include <immintrin.h> //AVX
#include <tmmintrin.h> //SSSE3
#include <iostream>
#include <stdexcept>
#include <array>
/// Function to calculate check digit with AVX2 intrinsics
/// parm: a 11 digit number as string
/// ret: an unsigned integer 0~11
@MaverickTse
MaverickTse / main.cpp
Created May 15, 2016 12:12
Vulkan initialization with GLFW and VK_CPP
// vulkan_fw_test.cpp : Defines the entry point for the console application.
//
#pragma comment(lib,"vulkan-1.lib") //DLL version
#pragma comment(lib,"glfw3.lib")
#define GLFW_INCLUDE_VULKAN //as required by GLFW
#include "stdafx.h" // optional headers
#include "vulkan\vk_cpp.hpp" //copy this header to your VulkanSDK include folder
#include "GLFW\glfw3.h" //GLFW header
/* Reference: https://userstyles.org/styles/120402/twitter-s-fav-button-back */
/* The is the old default star, no animation */
.HeartAnimationContainer:before,.Icon--heart:before{content:"\f147";display:block;font-family:"rosettaicons";font-weight:normal;font-style:normal;text-align:center;-webkit-font-smoothing:antialiased;}
.ProfileTweet-action--favorite.withHeartIcon.is-animating .HeartAnimation,.HeartAnimation{display:none!important;}
.tweet-action[rel="favorite"]:hover,.tweet-detail-action[rel="favorite"]:hover,.tweet-action[rel="favorite"]:focus,.tweet-detail-action[rel="favorite"]:focus,.tweet-action[rel="favorite"]:active,.tweet-detail-action[rel="favorite"]:active,.tweet-action.is-selected[rel="favorite"],.Icon--favorited,.Icon--colorFavorited,.ProfileTweet-action--favorite .ProfileTweet-actionButton:hover *,.ProfileTweet-action--favorite .ProfileTweet-actionButton:focus,.ProfileTweet-action--favorite .ProfileTweet-actionCount:hover,.ProfileTweet-action--favorite .ProfileTweet-actionCount:focus,.twe