Tag: Linux

  • 📂

    Giving a flatpak program access to home directory on Linux

    List out all of your installed Flatpaks and copy the “Application ID” for the Flatpak you want to give home directory access to.

    $ flatpak list

    Let’s assume we want to give the program “Insomnia” access to our home directory when it is used.

    The second column is the Application ID.

    The application ID for Insomnia is rest.insomnia.Insomnia.

    To give Insomnia access to your home directory, run the following:

    flatpak override --user --filesystem=home rest.insomnia.Insomnia

    Notes

    My knowledge of Flatpaks is limited so apologies if I end up being incorrect here.

    Flatpak’ed programs are self-contained installations that are sheltered from the system they are installed on. (Linux / security geeks may need to correct me here).

    By default, they don’t have access to the filesystem of your computer.

    I needed to give my own installation of Insomnia access to my system (just the home directory in my case) so that I could upload a file to it. The command above gives me that result.

    Other online tutorials

    There are some tutorials I’ve seen online that mention similar solutions, except using sudo and not including the --user flag. This didn’t give me the result I was needing.

    You see, without the --user flag, the command will try to update the Flatpak’s global configuration — which is why it needs sudo privileges.

    But by using the --user flag, we are only affecting the configuration for the current user, and so the sudo is not needed.


  • 📂

    Fixing my local development file / folder permissions

    sudo find . -type d -exec chmod g+rwx {} +
    sudo find . -type f -exec chmod g+rw {} +

  • 📂

    Bulk converting large PS4 screenshot png images into 1080p jpg’s

    I tend to have my screenshots set to the highest resolution when saving on my PlayStation 4.

    However, when I upload to the screenshots area of this website, I don’t want the images to be that big — either in dimensions or file size.

    This snippet is how I bulk convert those images ready for uploading. I use an Ubuntu 20.04 operating system when running this.

    # Make sure ImageMagick is installed
    sudo apt install imagemagick
    
    # Run the command
    mogrify -resize 1920x1080 -format jpg folder/*.png

    You can change the widthxheight dimensions after the -resize flag for your own required size. As well as changing the required image format after the -format flag.


  • 📂

    Updating PHP versions in Ubuntu 20.04

    For an older PHP project, I needed to install an older version of PHP. This is what I did to set that up.

    Installing a different PHP version

    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install -y php7.1

    Rebinding php to required version

    Some of these binds are probably not need. I think the main ones, at least for my use case, were php and phar.

    sudo update-alternatives --set php /usr/bin/php7.1
    sudo update-alternatives --set phar /usr/bin/phar7.1
    sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
    sudo update-alternatives --set phpize /usr/bin/phpize7.1
    sudo update-alternatives --set php-config /usr/bin/php-config7.1

    For some reason the --set flag stopped working, so I had to use:

    sudo update-alternatives --config php
    sudo update-alternatives --config phar
    
    etc. And update each one with the terminal prompt options for each.

    p.s. If using PHP-FPM, you could also set up different server conf files and point the FPM path to the version you need. My need was just because I was using the command line in the older project.


  • 📂

    100 Days : Day Seven (94)

    Decided to Install Windows 7 back on to my P.C. as the primary operating system, then run GNU/Linux within virtualbox. Thought I’d give steam games on windows another go as I’ve got 8gb of ram sat there not really doing much. This way all my development stuff can be encapsulated within the virtual machine.

    Also looks like I could be going to see Chas & Dave in a couple of months. I’d never heard much of their music until I started working at PM Connect. I gotta say they are growing on me.


  • 📂

    Trying out Crunchbang Plus Plus (#!++) on laptop. Bout time I tried a new distro.


  • 📂

    There is always a logical answer

    I installed Ubuntu server on my spare computer the other day and all was fine.

    I then moved the Apache document root to a directory in my home folder — a common thing done by people, I hear.

    I have done this many times before and always worked fine — as did this for a time.

    I had done this via ssh as is common with a server OS. Only thing was, was once I exited the ssh, Apache seemed to stop working.

    I spent about an hour then, at around midnight, trying to figure out what had gone wrong. What had I done differently? The answer was simple: nothing…… or so I thought.

    Turns out I had encrypted my home directory on installation of the OS. Probably a good thing to do, except that of course when trying to view the Apache server page in a browser it would error — due to my having moved it’s root from its default into my home folder.

    As soon as I logged in via ssh to the server, it would work again. But when exiting it would stop.

    This was simply down to the fact that my logging into the home directory via ssh would cause it to decrypt itself — making the apache page viewable. And then when I exited the ssh, it would re-encypt, thus breaking it.

    Fu fu fu.

    Off to see Mission Impossible: Rogue Nation tonight. Really looking forward to it.

    I just hope there are no annoying people about. i.e. screaming kids, idiots on phones, people saying things like “Oh he was in thingymajig” or “This bit is sick”.

    I must be getting old.


  • 📂

    Installing Ubuntu server. Crazy Friday night, I know.


  • 📂

    Back on Linux Mint. So far so good. Nvidia drivers installed so hopefully wont have any more crashing.


  • 📂

    I’m not looking forward to tonight’s reinstallation of Linux. Not after last night’s faff.