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 https://www.twitch.tv/burkeblack
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 https://www.twitch.tv/burkeblack --ytdl-format=Medium

Sunday, January 15, 2017

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

mpv -no-video --shuffle --loop https://www.youtube.com/playlist?list=PL55713C70BA91BD6E

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"

Thursday, January 05, 2017

Arch Xfce: Add print screen screenshot window

Add the following coomands to keyboard shortcuts into xfce4:
 xfce4-screenshooter -f
 xfce4-screenshooter -w

Tuesday, January 03, 2017

Arch: Specify clang in Clion

Go to Preferences/Settings -> Build, Execution, Deployment -> CMake -> CMake option -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++


Monday, January 02, 2017

Lightttpd: Put website on different port

sudo vim /etc/lighttpd/lighttpd.conf and add for example: $SERVER["socket"] == ":81" {
server.document-root = "/srv/www/mysite"
}

Arch: FAILED (unknown public key 2E1AC68ED40814E0)

gpg --recv-keys --keyserver hkp://pgp.mit.edu 2E1AC68ED40814E0 or gpg --recv-keys --keyserver http://pgp.mit.edu:11371 2E1AC68ED40814E0 or sudo pacman-key -r 2E1AC68ED40814E0

Arch Linux: Install lighttpd and php.

sudo pacman -S lighttpd php-fpm
Add the folowing line to: /etc/lighttpd/lighttpd.conf include "conf.d/fastcgi.conf"
Create folder conf.d and file fastcgi.conf with the following contents:
server.modules += ( "mod_fastcgi" )

index-file.names += ( "index.php" )

fastcgi.server = (
".php" => (
"localhost" => (
"socket" => "/run/php-fpm/php-fpm.sock",
"broken-scriptfilename" => "enable"
))
)

Enable php-fpm and lighttpd services: sudo systemctl enable php-fpm
sudo systemctl enable lighttpd

To start now php-fpm and lighttpd services: sudo systemctl start php-fpm
sudo systemctl start lighttpd

To check, go to /srv/www/ and create file index.php <?php
phpinfo();
?>
Make sure index.php has permission to be executed and read. To enable phpmyadmin sudo pacman -S phpmyadmin And place the following in /etc/lighttpd/lighttpd.conf alias.url = ( "/phpmyadmin" => "/usr/share/webapps/phpMyAdmin/")

server.modules = (
"mod_alias"
)