Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import json
import re
import requests
# import requests_cache
import os
import hashlib
# percol-cdr my custom
setopt BASH_REMATCH
function percol-cdr () {
local selected_line="$( cdr -l | percol )"
if [ -n "$selected_line" ]; then
if [[ "$selected_line" =~ ^[0-9]+ ]]; then
local selected_num=$BASH_REMATCH[1]
cdr $selected_num > /dev/null
else
@aont
aont / todo.gs
Last active October 16, 2019 07:57
function getSheet() {
return SpreadsheetApp.getActiveSheet();
}
function getColumnByName(sheet, string) {
var lastCol = sheet.getLastColumn();
var range = sheet.getRange(1, 1, 1, lastCol)
var values = range.getValues()[0];
for (i=0; i<lastCol; i++) {
#!/usr/bin/env python
# Usage:
# $ ./m3u8_mod.py $M3U8URL | ffmpeg -allowed_extensions ALL -protocol_whitelist pipe,file,http,https,tcp,tls,crypto -i - -movflags faststart -c copy out.mp4
import sys
import requests
import re
if __name__ == u'__main__':
m3u8_url = sys.argv[1]
@aont
aont / lame.md
Last active March 22, 2024 01:53
lame favorite option
lame -q 0 --vbr-old -V 4 $INPUT $OUTPUT
ffmpeg -i "audio.m4a" -f wav "audio.wav"

lame -q 0 --vbr-old -V 4 --add-id3v2 --pad-id3v2 --ta "Artist" --tt "Title" --tl "Album" --tv "TPE2=Album Artist"  "audio.wav" "audio.mp3"

mono image

gs -sDEVICE=pdfwrite -dNOPAUSE -dCompatibilityLevel=1.4 -sOutputFile=test.pdf -dFITPAGE -- "viewpbm.ps" image-0000.pbm image-0001.pbm image-0002.pbm

grey or color

# using viewpbm.ps directly is ok, but unexpected page margin is generated...
convert *.png tmp.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterMonoImages=false  -dMonoImageFilter=/CCITTFaxEncode -dCompatibilityLevel=1.4 -sOutputFile=out.pdf -dFITPAGE -- tmp.pdf
@aont
aont / x11vnc.md
Last active October 12, 2019 09:11

Transfer PHYSICAL display on VNC protocol

ps auxw | grep Xorg
# you'll see something like
#    Xorg vt1 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 3
# check the -auth value
export XAUTHFILE=/run/user/1000/gdm/Xauthority

x11vnc -display :0 -auth "$XAUTHFILE" -noxdamage -forever

WindowsでMacのように、IME-ON IME-OFFする

  • 「無変換」-「入力/変換済文字なし」をIME-オフ
  • 「変換」-「入力/変換済文字なし」をIME-オン

スクリーンキャプチャ

use namedpipe on Windows

client -> server

# on terminal A
namedpipe.exe server test read
# you will see "hoge"

# on terminal B
echo hoge | namedpipe.exe client test write