Sunday, 22 July 2018

Photography and Stuff

I'm going to wander a bit off course now and then with this, but it's about photography as a hobby, self esteem and a bit of depression gets thrown in too,

Let's get started with depression, I do suffer occasionally, but thankfully manage to sort myself out, sometimes it's easy and sometimes it's not. An acquaintance of mine shared a post once that asked questions about depression. One of the questions was, "Do you go to bed, not because you're tired, but because you don't want to be awake anymore"?

My honest answer is that I do.

Going back to my teens, life was crap. My mother died, i went off the rails, had a failed marriage, stupidly gave up some good jobs and it was only in my late 40s, thanks to some good friends, relatives, a kick up the arse and more especially a wonderful new partner that things started to come together. There are days when I struggle, but I put on a brave face and get myself sorted.

You may now be thinking, what the hell has this got to do with photography?

I enjoy getting out with a camera, I've upgrade to a reasonable DSLR with some decent lenses and enjoy wildlife, quite often it's not the quality of the picture, it's just that I've got something new. Same with landscape,  if I like it I'll snap it.

I've listened to people who insist that the only way to get a decent picture is to use RAW and then process it afterwards to get the most out of the picture. This may be true, but it adds a lot of work to the process but it can be worth whiile

Then several  remarks from people who really should have know better made we want to sell up my stuff and give up, this together with me being on a downward spiral at the time made we look at selling all my gear and getting a cheap point and click camera as in the words of the people in question, "a lot of my pictures were crap".

A few days later, a work colleague of mine said these words to me, "I've not seen any pictures of yours lately, the nature ones really brighten my day up". Bless her, this is what I wanted to hear, I discarded the decision to get rid of my gear and decided to go back to using it the way I wanted to.

While taking wildlife, I leave the camera set to JPG fine mode, with a Sony SLT, you can judge if the exposure is right when you take the picture, if it's too dark or too light you can tweak it as you're taking it. For landscape, I still use RAW as you quite often have to deal with a huge range of brightness.

My enjoyment has gone through the roof.

So in the end, be yourself, don't try and be somebody else, it will only make you unhappy, do the things you like to do, listen to the music that hits your emotions, ignore negative people, enjoy life as much as you can and be the person you want to be

Lots of rambling there, some of it may not make sense to you but it will to some people.





Thursday, 12 July 2018

Ubuntu 18.04

I've been a fan and user of Linux for some years now, having dumped Windows about the same time that Microsoft released Service Patch 2 for Windows XP. My journey started with Mandrake, which re branded itself as Mandriva, then onto PCLinuxOS for some years before moving to Ubuntu, I still have a soft spot for PCLinuxOS, it's really a good distro but I've lost the love for KDE but I may try some of the other releases they do.

The main reason behind the move to Ubuntu is that I needed to provide support for it, I was initially using the Gnome 2 desktop and then they released Unity on the world.. It was hated by everyone at first, but I forced myself to use it and after a while I realised how good it was, it didn't get in the way of your work and with a few tweaks was perfect. Ubuntu 14.04 came and went, then we had 16.04 and then Canonical dropped the bombshell that they were bringing Unity to an end and would move their distro to Gnome 3.

Now I'd tried this with Fedora and a few other distros in the past and my experience wasn't great to be honest. Along came the release of Ubuntu 18.04, I tried it and went back to 16.04. But I realised that this was now a dead end, there was no more development and I needed to move forward.

XFCE was suggested and Cinnamon as per Linux Mint, to be fair to XFCE it works but it didn't feel right, Cinnamon and in fact Mint felt sluggish to me, and this showed in tests playing high def video clips, KDE out of the box is just ugly and I know I could customise it but when I did, overall it just didn't look right, so it was back to Gnome 3.

I moved the launcher to the bottom, but the application icon was on the right and not on the left as I was used to, I did some digging round and found that by running

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true

followed by

sudo -i

echo show-apps-at-top=true >> /usr/share/glib-2.0/schemas/10_ubuntu-dock.gschema.override

glib-compile-schemas /usr/share/glib-2.0/schemas/

I could move the button to the left where I liked it.

Next thing was the display, everything looked too big, the display size was right but the fonts were far too big, Linux Mint seemed to have this sorted so I looked at the settings there and after having installed Gnome Tweaks with:

sudo apt-get install gnome-tweaks

I changed the fonts to those from Linux Mint except for the monospace one, I just dropped that by one size and it was all starting to come together.

My other issue is with the top of the screen, in Unity the menu items appeared here but on Gnome 3 it's just a huge area of space that's wasted.

Some more digging round came up with a Gnome extension called "Dash to Panel", I installed this and the top bar vanished and the icons displayed in it appeared on the right hand side of the launcher bar.

This is now looking good and I'm starting to like it, the close and minimise buttons in Gnome 3 are back on the right, I like them on the left so I moved them back with Gnome Tweaks and I now have a desktop that I'm starting to like.

I still need a few tweaks before I'm delighted, the workspace switcher in Unity worked like a dream and I've not seen anything on another desktop that compares with it. and the close and minimise buttons on Google are slightly smaller than the other apps.

After a reboot, my OwnCloud client couldn't find a keychain, I fixed this with

sudo apt-get install libgnome-keyring0

If I could find a way to add the menus back to the file manager I would now be delighted.

I've also installed an app called Wallch, short for wallpaper changer, I'll let you guess what that does.

My last gripe is with a thing called Snap and similarly Flatpak, this is a newish idea to create a one off package that can work on any Linux distro, all the dependecies are included in the package to no more ppas needed. Brilliant idea except, that I have and SSD and normal HDD in my desktop, the Snap applications by default aren't able to read data from anything other than the main drive, you can enable the option to read removable media but this isn't available across all applications.

Let's see how I get on with this and more updates will follow as I find ways to tweak and and improve.



And finally, here's the desktop straight out of the box.



And now after the tweaking



I have just remembered something else, by default you now get some irritating emojis popping up over certain words in Thunderbird, if you install the font manager with:

sudo apt-get install font-manager

Run it and disable Noto Color Emoji


You will find the annoyance all gone, you may get the odd character that can't be displayed but that's easy to live with.

Wednesday, 13 June 2018

SSH Stuff

I've just managed to install a load of stuff onto my desktop as I didn't realise I wasn't connected to a remote machine via ssh.

G+ gave me a suggestion about changing the login colours on the remote machine so a bit of searching came up with this.

Connect via ssh and run

nano .bashrc

Add this lot in just above the last fi

#Make prompt colored when logged in remote
export NON_LOCAL_LOGIN=`env | grep SSH`
if [ "$NON_LOCAL_LOGIN" != "" ]; then
       PS1="\033[33m[\u@\h:\w]#\033[0m "
fi;

Save and close and you're sorted

Original answer came from here

Saturday, 9 June 2018

More NewzNab Stuff

Back to getting Newznab running on a Raspberry Pi, I want to add some extra storage for the NZB files, so I'll be connecting 2 x 32Gb USB sticks in a RAID 1 array, I'll initially use the sticks in an lvm in case I want to increase the size at a later date, I won't be going through how to install Raspbian or configure the Pi with a static address, plenty of articles about this elsewhere. I would encourage you to make a new super user on the Pi and then delete the Pi user for security reasons

Once the initial install has finished it's time to ssh into the server with:


ssh servername


And then we'll get started with some updates and installation of the required packages.


First off we need to run:


sudo nano /etc/apt/sources.list 


Uncomment the line that says 




deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

Once we've done that we can begin

sudo -s

cd  /root

apt update && apt upgrade

apt-get build-dep unrar-nonfree


apt-get source -b unrar-nonfree


sudo dpkg -i unrar_5.2.7-0.1_armhf.deb

Next we install ZRAM to imrpove the performance

sudo wget -O /usr/bin/zram.sh https://raw.githubusercontent.com/novaspirit/rpi_zram/master/\zram.sh

chmod +x /usr/bin/zram.sh

And then add a line to /etc/rc.local to get it running on boot

sudo nano /etc/rc.local

Insert the line shown below before the exit 0, save the file and reboot

/usr/bin/zram.sh


Time now to install some software

sudo -i

apt install ssh screen apache2 php mysql-server libapache2-mod-php php-pear php-gd php-mysql php-curl php-json unrar lame mediainfo subversion ffmpeg memcached mc nfs-common lvm2 mdadm -y


Once that's all finished we will tighten up the SQL security with this:

mysql_secure_installation


Now it's time to create the SQL database:

mysql -u root -p


CREATE DATABASE newznab;

USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;


And then we edit the mysql config


nano /etc/mysql/conf.d/mysql.cnf


Add the following to the bottom


[mysqld]

group_concat_max_len=8192
innodb_flush_log_at_trx_commit = 2

Save that and then edit this file


nano /etc/mysql/my.cnf


Add this to the bottom


[mysqld]

sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

Time now to add the external storage, plug the drives in, if you plug them into the sockets nearest the ethernet connector they should be recognised as /dev/sda and /dev/sdb and stay that way too.


Run 


fdisk /dev/sda


Delete any existing partion and creat a new one, then do the same for /dev/sdb


Might be worth a restart if you get any messages about the kernel using the old table.


Prepare the partitions with


sudo pvcreate /dev/sda1 /dev/sdb1


Make two volume groups for each drive with this command


Now we create two  "Volume Groups" with the command:


sudo vgcreate newznab1 /dev/sda1


sudo vgcreate newznab2 /dev/sdb1


Now we give all the drive space to the volume with:


sudo lvcreate -l 100%FREE -n newznablv1 newznab1


sudo lvcreate -l 100%FREE -n newznablv2 newznab2


This creates two devices called /dev/newznab1/newznablv1 and 
/dev/newznab2/newznablv2

Next it's time to create the filesystem with the command:


sudo mkfs.ext4 /dev/newznab1/newznablv1


sudo mkfs.ext4 /dev/newznab2/newznablv2



Time to make the RAID 1 array


sudo mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/newznab1/newznablv1 /dev/newznab2/newznablv2


Create a filesystem with 


sudo mkfs.ext4 /dev/md0


Now we create a mount point

sudo mkdir  /var/www/newznab

Update fstab to start mount on reboot

echo "/dev/md0 /var/www/newznab/ ext4 defaults,noatime 0 1" | sudo tee -a /etc/fstab

And finally update mdadm to start it at boot, don't run this twice

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

Now we make the directory structure:

sudo -i


mkdir /var/www/newznab

mkdir /var/www/newznab/htdocs
mkdir /var/www/newznab/logs

Now it's time to get Newznab, you can get it here, I suggest you get the paid version, it's cheap and it's much better and these instructions are written with it in mind.


Let's get it installed with 


svn co svn://svn.newznab.com/nn/branches/nnplus /var/www/newznab/htdocs/


Now we make the directories writable with


chmod 777 /var/www/newznab/htdocs/www/lib/smarty/templates_c
chmod 777 /var/www/newznab/htdocs/www/covers/movies
chmod 777 /var/www/newznab/htdocs/www/covers/anime
chmod 777 /var/www/newznab/htdocs/www/covers/music
chmod 777 /var/www/newznab/htdocs/www/covers/tv
chmod 777 /var/www/newznab/htdocs/www
chmod 777 /var/www/newznab/htdocs/www/install
chmod -R 777 /var/www/newznab/htdocs/nzbfiles/

And then make a config for Apache to use


nano /etc/apache2/sites-available/newznab.conf


Paste this into it:


<VirtualHost *:80>
    <Directory /var/www/newznab/htdocs/www/>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    DocumentRoot /var/www/newznab/htdocs/www

    ErrorLog /var/www/newznab/logs/error.log
    CustomLog /var/www/newznab/logs/access.log combined
</VirtualHost>

You can change the port in the top line to something else if you want but you have to add a line to


etc/apache2/ports.conf


That says


Listen 8080 or whatever port you choose.


Now some config file changes with:


nano /etc/php/7.0/apache2/php.ini


Find these values and change them as shown below, they are listed in order:


max_execution_time = 120

memory_limit = -1
date.timezone = 'Europe/London'

Now we activate the server and deactivate the default one with:


a2dissite 000-default.conf

a2ensite newznab
a2enmod rewrite
service apache2 restart
service mysql restart


And point your browser to:



http://server:port to finish setting up Newznab itself


Once you've finished the initial setup, go the admin section and click on edit site, find these options and change the values to the ones shown below, you don't have to change the default home page if you don't want to.


default home page : /browse

newznabID : <provided in signup email>
unrar path : /usr/bin/unrar
mediainfo path : /usr/bin/mediainfo
ffmpeg path : /usr/bin/ffmpeg
lame path : /usr/bin/lame
integrated cleanup : yes
save audio preview : yes
check for password : deep
delete passworded releases : yes


Activate one group, probably alt.binaries.teevee


Then let's try running an update



cd /var/www/newznab/htdocs/misc/update_scripts

php update_binaries.php
php update_releases.php

Once completed you should see some articles appearing

There's a lot more information here on how to get Newznab running to continuously pull updates here, the one thing that you shouldn't do is use a cron job.

Hope that helps, it's not fast but it's quiet and it works


Sunday, 31 December 2017

Facebook

Farcebook is once again pissing me off in great style, I reinstalled the messenger app to enable me to stay in touch with a few people, within minutes the phone was going berserk with waves, other stupid messages and loads of other crap. Then the pass this message on and keep the candle burning stuff started, 10 minutes later it was off the phone and Facebook was once again resigned to the desktop only.

I really would like to dump it as these days it is generally an annoyance with all the fake news and so on.

I'm going to try and see what I can do, I much prefer the Google + world, it's not perfect. I prefer Twitter and Instagram isn't too bad even though it's run by Facebook. I tried Snapchat for about 10 minutes, can't see what use it is other than putting stupid dog ears on your head.

Wishing you all a Happy Year of the Justifiably Defensive Lobster and that's me pretty much done on Interwebs stuff till next year.

Saturday, 23 December 2017

Spotweb on Bionic Beaver

Wanted to get Spotweb running on a local machine to do some newsgroup indexing, lots of instructions out there for Raspberry Pis and older versions of Ubuntu with php 5. I've decided to go and install it on a virtual server running Bionic Beaver, it was a lot easier than I expected.

Start off with installing the OS and then updating it.


sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
sudo shutdown -r now

Then install the required apps:

sudo apt-get install mysql-server php-mysql php-curl php-gd php-cli nginx openssl php-fpm git zip mc php-mbstring php-xml -y


Change a couple of files:

sudo nano /etc/php/7.1/fpm/php.ini

Change these lines

date.timezone = Europe/Copenhagen
memory_limit = 512M


And do the same here:

sudo nano /etc/php5/cli/php.ini




Make the webserver config file:

sudo nano /etc/nginx/sites-available/spotweb

Copy and paste this into the file:

server {
listen 80;
server_name htpcguides.crabdance.com, 192.168.40.120;
root /var/www;
index index.html index.htm index.php;

location /spotweb {


        satisfy any;


        if ($uri !~ "api/"){

                rewrite /api/?$ /spotweb/index.php?page=newznabapi last;
        }
location ~ \.php$ {
                try_files $uri =404;
                include fastcgi_params;
                fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
}
}
}

Save it and then close nano


Activate the configuration

sudo -i

unlink /etc/nginx/sites-enabled/default

ln -s /etc/nginx/sites-available/spotweb /etc/nginx/sites-enabled/spotweb


Install Spotweb:


git clone https://github.com/spotweb/spotweb /var/www/spotweb

Sort out the permissions:


chown -R www-data:www-data /var/www/spotweb

Create the database, replace the word password with your password but leave the ' ' in place:
mysql -u root -p

CREATE USER spotwebuser@localhost IDENTIFIED BY 'password';
CREATE DATABASE spotwebdb;
GRANT ALL PRIVILEGES ON spotwebdb.* TO spotwebuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;


Go for a reboot


sudo shutdown -r now

And now finish the configuration off with your browser.


Go to http://ip.address/spotweb/install.php

Do an initial download and then setup a cron job to run:

php retrieve.php from the /var/www/spotweb directory.


Friday, 22 December 2017

Nextcloud install, the easy way.

I'm already running an ownCloud server, I decided it was time to try and setup another one running Nextcloud. My ownCloud server is running on a shared hosting platform, I've decided to run up NextCloud on a virtual machine under Virtualbox, I'm not going to go into the setup of this bit here, just the configuration of the cloud server.

In the past, I've messed round with installing, SQL, Apache and so on, I thought I'd give the Ubuntu snap package a go.

I've run up Ubuntu 16.04 server, installed SSH onto it so I can manage it from command line and next it was time to install NextCloud.

sudo snap install nextcloud

That's it, it's done and installed, just a few more things to get it working and install lets encrypt, to finalise the whole install, ports 80 and 443 need to be accessible from the Interwebs, I temporarily put the server into the dmz.

Adjust the memory limits with:

sudo snap set nextcloud php.memory-limit=-1

Tell it which ports to listen to with:

sudo snap set nextcloud ports.http=80 ports.https=443

Restart Apache with:

systemctl restart snap.nextcloud.apache

Configure https and install lets encrypt with:

sudo nextcloud.enable-https lets-encrypt

Follow the instructions and you can then remove the port 80 access and connect to your server with:

https://domaine.name or https://ipaddress

The final configuration is done via web browser.

It really was that easy