Sunday, February 19, 2017

Tuesday, February 14, 2017

Imagemagick: bash split large images into smaller

for f in *.tiff ; do fbase=`echo $f | cut -d '.' -f 1`; echo $fbase; convert -crop 510x510 +repage $f sub/${fbase}_%02d.tiff ; done

Thursday, February 09, 2017

Sunday, January 22, 2017

Monday, January 16, 2017

MPV: Check twitch stream quality and specify one

Get stream format codes and avaliable resolutions youtube-dl -F
Gives, e.g.: [twitch:stream] burkeblack: Downloading stream JSON
[twitch:stream] burkeblack: Downloading channel access token
[twitch:stream] burkeblack: Downloading m3u8 information
[info] Available formats for 24252344256:
format code extension resolution note
meta mp4 multiple Quality selection URL
Audio_Only mp4 audio only 128k , mp4a.40.2@3561785328572937k
Mobile mp4 400x226 292k , avc1.66.30, mp4a.40.2
Low mp4 640x360 692k , avc1.66.30, mp4a.40.2
Medium mp4 852x480 992k , avc1.77.30, mp4a.40.2
High mp4 1280x720 1760k , avc1.77.31, mp4a.40.2
Source mp4 1280x720 3561k , avc1.4D4020, mp4a.40.2 (best)

Select the quality format you want, and play it. For example, for medium: mpv --ytdl-format=Medium

Sunday, January 15, 2017

MPV: Play youtube playlist with shuffle and repeat (i.e. loop)

mpv -no-video --shuffle --loop

Saturday, January 07, 2017

wondershaper: bashrc aliases

Assuming name of interface to use is `enp0s3`. Yours can be different. Thus, needs to change it wshaperstart()
local downloads=3000;
local uploads=50;

[[ -n $1 ]] && downloads=$1;
[[ -n $2 ]] && uploads=$2;

echo "Executing: sudo wondershaper -a enp0s3 -d $downloads -u $uploads";

sudo wondershaper -a enp0s3 -d $downloads -u $uploads

alias wshaperclear="sudo wondershaper -c -a enp0s3"