Wednesday, January 11, 2017

Libreoffice: Batch convert word files (docx) to pdf

soffice --headless -convert-to pdf *.docx --outdir some_output_folder

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"
)

Tuesday, December 27, 2016

Git: apply pull request as patch

curl -L https://github.com/monero-project/monero/pull/1507.patch | git apply -v -

Saturday, December 10, 2016

VirtualBox – Cannot Register the Hard Drive Because a Hard Drive with UUID Already Exists

After moving virtualbox folder to new location, cant boot any vm. To fix this, one can use this for example vboxmanage internalcommands sethduuid /mnt/stuff/linux_backup/VirtualBox\ VMs/w7/w7.vdi

Wednesday, December 07, 2016

Copy and paste adds adds 0~ and 1~

From here: http://unix.stackexchange.com/questions/196098/copy-paste-in-xfce4-terminal-adds-0-and-1
Add this to .bashrc: printf "\e[?2004l"