Skip to content

Instantly share code, notes, and snippets.

@tknr
tknr / mkv2mp4.sh
Created June 26, 2025 16:13
mkv2mp4
#!/bin/bash
IFS=$'\n'
for mkv in `find . -name "*.mkv"`;do
echo ${mkv}
STREAM_NO=`ffprobe -hide_banner -v error -i ${mkv} -show_streams -of json | jq -c '.streams[] | select(.codec_name == "subrip")' | jq '.index'`
echo ${STREAM_NO}
ffmpeg -y -i ${mkv} -map 0:${STREAM_NO} ${mkv%%.mkv}.srt
nice -n 19 ffmpeg -hide_banner -y -i "${mkv}" -movflags +faststart -codec:v libx264 -vf pad="width=ceil(iw/2)*2:height=ceil(ih/2)*2" -preset:v fast -acodec aac -b:a 192k -aac_coder twoloop "${mkv%%.mkv}.mp4"
done
cat php.ini.org | grep -v ";" | grep -v '^\s*$' > php.ini
export IFS=$'\n';for file in `find . -iname "*.avif"`;do echo "${file} -> ${file%%.avif}.jpg";convert "${file}" "${file%%.avif}.jpg" && /bin/rm -vf "${file}";done
// ==UserScript==
// @name nicovideo fake premium
// @namespace https://piou.dev
// @include https://www.nicovideo.jp/watch/*
// @version 1.2.0
// @grant none
// @run-at document-start
// ==/UserScript==
const observer = new MutationObserver((mutations) => {
@tknr
tknr / drawthumbnail.js
Created March 24, 2022 01:38
文字列から画像生成
String.prototype.toZenkaku = function () {
return String(this).replace(/[!-~]/g, function (all) {
return String.fromCharCode(all.charCodeAt(0) + 0xFEE0);
});
}
String.prototype.chunk = function (length) {
return this.match(new RegExp('.{1,' + length + '}', 'g'));
}
@tknr
tknr / compact_all.sh
Last active January 25, 2022 09:42
do compact all virtualbox hdds
#/bin/bash
## https://www.ringosan.net/?p=258
export IFS=$'\n'
for uuid in `vboxmanage list hdds | grep ^UUID | sed 's/ //g'| cut -d ':' -f 2`
do
echo ${uuid}
vboxmanage modifyhd ${uuid} --compact
done
<#
.SYNOPSIS
exports installed packages.
.DESCRIPTION
exports installed packages:
exportChocolatey.ps1 > packages.config
You can install the packages using :
choco install packages.config -y
.LINK
https://gist.github.com/alimbada/449ddf65b4ef9752eff3
@tknr
tknr / dommune.html
Created May 28, 2019 11:21
dommuneがustreamで放送されてた頃に画面いっぱいに見るためのhtml。今はもう使えないので放流
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>
dommune
</title>
<style type="text/css">
<!--
#body{ margin: 0px; } #video { margin:0px; padding:0px; } #timeline { margin:0px; padding:0px; }
@tknr
tknr / optimize_sqlite_db.sh
Created March 21, 2019 16:21
optimize sqlite db files
## http://d-goo.hatenablog.com/entry/2013/07/30/124148
for db in `find ~/ -name *.db`;do echo ${db};sqlite3 ${db} vacuum; sqlite3 ${db} reindex;done
#!/bin/bash -x
echo "this command must be executed in root user."
if [ ${EUID:-${UID}} != 0 ]; then
echo 'do this with being root . for example : sudo su - '
exit 1;
fi
## install maildev
yum -y install nodejs npm postfix