Removing stubborn files from the trash

Sometimes we are forced to delete files as a superuser which places them in the trash but doesn't purge them from the system. Then when we try and empty trash as our lowly normal user we get a whole bunch of errors thrown up at us. In this situation it's handy to know that the trash folder is located at $HOME/.local/share/Trash

Now we can use this command :

rm -rf ~/.local/share/Trash/*

The rm command removes (delete) files or directories.

Changing the submitted to in drupal

https://www.drupal.org/node/71581

http://drupal.stackexchange.com/questions/185880/change-article-date-format

 

in other words change


           {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}in /core/themes/bartik/templates/node.html.twig

to

           {% set createdDate = node.getCreatedTime|date('j F Y') %}

     {% trans %}By {{ author_name }} on {{ createdDate }} {% endtrans %}

and save.

Adding a watermark to a video

To use avconv to watermark a video first create a PNG the same dimensions as the video file with everything but the desired watermark set to transparent.

avconv -i input -vf 'movie=videowatermark.png [watermark];[in][watermark] overlay=0:0 [out]' -c:v libx264 -preset slow -crf 20 -c:a libmp3lame -b:a 192k output.mp4

Remember to use single quotes

 

Reference.

Twig basics

<ol>

{% for key, value in _context %}

<li>{{ key }}</li>

{% endfor %}

</ol>

 


{% node--type-[type] %}
{% node--[type].html.twig %}

 

 

Converting m4a to mp3

To convert every .m4a file in a directory to an mp3

$ for file in *.m4a; do avconv -i "$file" "${file/.m4a/.mp3}" done

The ${file/.m4a/.mp3} takes the file name and removes the .m4a suffix and replaces it with the .mp3 suffix. The format is deduced from the extension

To add more features

$ for file in *.m4a; do avconv -i "$file" -vn -qscale 1 "${file/.m4a/.mp3}" done

Playing Zork! on Linux

To play Zork! you first need to install Z-Machine interperter (Z-Machine being a basic virtual machine that executes the data files for Zork and other interactive fiction titles)

sudo apt-get install frotz

Now download the files here. Having downloaded and decompressed these files, you simply enter: frotz filename Where filename is the Z-Machine file.

Bannister Technologies Website

Here I try and record all the steps, trials and tribulations encountered in the designing of this website. Hopefully this will aid others and also it will serve as a reference to me as I'm always forgetting how I actually did stuff.

This site is built upon Drupal 8. My intention is to use as few external modules as possible as in the past I've made Drupal sites and the dramas I've encountered when modules aren't released for the next Drupal version have driven me crazy!