4 results for linux in tags

Clear

Organizing a Game Development and Music Asset Library

Another thing I’ve been meaning to do for some time is organize all of my game development and music production assets. I’ve been looking for a good web-based file browser that has advanced search features (potentially with AI) that can be hosted in a docker. This would make life easier when searching for things. Unfortunately, there aren’t many choices, so maybe I will get around to programming one myself; but in the mean time, I need to organize the files.

First, I downloaded all of my assets from the different store front websites. (Itch.io, GameDevMarket, Fanatical, Humble Bundle, AAS, what I could extract from Unity, and Unreal, and Patreon).

Next, on the server, I created my assets folder, and created the root structure for all of the assets. I haven’t really planned everything out yet, but I figured that if I started at the top, I could slowly start nesting the proper way. (The /STORES/ directory is just for holding the zip files until I get them sorted).

./assets ├── 3d-printer ├── STORES ├── artwork ├── audio ├── brushes ├── fonts ├── software └── vst

Because I have a lot of assets, and I tend to “test” things out with bash during my process, I have a safe location for the original zip files so that I can recover if needed without having to download everything again.

According to ‘du’, the total size of my compressed asset collection is approximately 185GB.

du -hLx /mnt/user/storage/Original\ Downloaded\ Assets/ | awk ‘END{ print $1 }’

185G

Now, if you are like me, and you are also trying to organize your assets, I highly suggest you set up your collection storage like I did (with all of your original asset downloaded files in a separate location). It’s easy to identify missing files and manage what you’ve downloaded. For instance, I have about 130 purchases on Fanatical, and I have 130 downloads in my Fanatical folder. For someone like me, it just makes sense.

When ready, copy your assets into a temp folder where you can parse and organize your collection without modifying the originals.

rsync -arp /mnt/user/storage/Original\ Downloaded\ Assets/ /mnt/user/assets/STORES/

(Remember how linux works, commands almost always following the [command] [arguments] [source] [destination] methodology.). And, if you need to look up what arguments I’ve used, you can ‘man’ the command or use ‘–help’.

 ‘-a’ is archive mode; which preserves as many of the attributes possible ‘-r’ is recursive mode; it will go into sub-directories and copy files and directories as well ‘p’ is preserve permissions mode; this just keeps the permissions the same when copied. (Probably redundant with -a, but it’s a force of habit for me).

You can also use ‘–info=progress2’ if you want to see the approximate time remaining.

Now that there is a good copy of the library, the next step is to separate the most easily identifiable group first. I chose audio because they are simple to identify and most art-based assets don’t have audio files. I think the best starting group of file extensions is: wav, mid, midi, mp3, flac, acc, ogg, wma, and voc. Of course, if you need more, just add them in. This is just my list.

** because I know there are duplicates in my library, I do a simple find / delete to remove the files. It just so happens that Firefox appends a ‘(1)’ to the end of files that are downloaded twice (or that have the same name).

find ./STORES/ -type f -iname “(1)

After inspecting the list to make sure that nothing is wrong, then I just add remove at the end:

find ./STORES/ -type f -iname “(1)” -exec rm {} ;

Now, this is also a smart time to standardize the names. A lot of times, these asset files don’t have a naming standard, so some things are all caps, some are camel case, some have spaces, while others use underscores or dashes. I like to remove all special characters with the exception of dash and dot. I also like to force everything to lowercase. It’s the easiest to work with at this moment. This bash line just finds all files within a directory (recursively), and then renames the file with the previously mentioned convention. (All lowercase and replaces spaces and underscores with a dash).

find . -type f -exec sh -c ’new_name=$(echo “${1##*/}” | tr “[:upper:]” “[:lower:]” | sed “s/[ _]/-/g; s/[^a-zA-Z0-9.-]//g”); dir_name=$(dirname “$1”); mv “$1” “$dir_name/$new_name”’ _ {} ;

This command will search all the zip files for these file extensions, if the zip file has this file type, then it will move the zip file to the specified location. This is probably one of my -more- favorite bash one-liners as it is very useful for looking in a zip file but not extracting it, and it is fairly quick.

find ./STORES/ -type f -iname “*.zip” -exec sh -c ‘unzip -l “{}” | grep -Ei “.(wav|mid|midi|mp3|flac|acc|ogg|wma|voc)$” && mv “{}” ./audio/’ ;

Next, I moved all of the stl files. (Same command, but this time I searched for ‘stl’ and ‘gcode’).

You can run this as many times as you’d like to get all of the desired zip files where they need to go. My goal is to just narrow everything down so that it’s easier to identify everything.

Using ddclient to Update DDNS on Google Domains

‘ddclient’ is a simple DDNS callback program developed in Perl. It reports the IP address to the DDNS server to automatically update your machine’s IP address. One of the great features is that it’s compatible with Google Domains. In order to get it working, you need to install it from your distro’s package manager. (pacman, apt-get, emerge etc.)

Once installed, locate your ddclient.conf (most likely in /etc/ddclient/) and edit it with the following block:

daemon=300
syslog=yes
pid=/var/run/ddclient.pid
ssl=yes

use=web, web=https://domains.google.com/checkip
protocol=dyndns2
server=domains.google.com
login=LOGIN-FROM-GOOGLE
password=PASSWORD-FROM-GOOGLE
WWW.MYWEB.SITE

For the login and password, when you log into your domains.google.com account and navigate to your Synthetic records and get your username and password credentials from clicking the view option. Make sure that your website matches and the credentials are case sensitive.

Once you have updated ddclient.conf, save it, and start the system service:

sudo systemctl start ddclient.service sudo systemctl enable ddclient.service

or for others:

sudo service ddclient start sudo update-rc.d ddclient enable

When complete, it takes about 1-2 minutes for everything to update and then your DDNS should be working and pointing your IP address to your domain name.

Using ddclient to Update DDNS on Google Domains

Obtaining SSL Encryption Certificates for Apache on Arch Linux

This has been an issue for me for quite some time. I have been trying to get SSL working and get valid certificates so that I could secure a few things and offer better security. Additionally, these days, having secure http is an added benefit. Most web-based server functions prefer the use of https over http for the extra security as well.

Here is how I got SSL and the proper encryption installed on Arch Linux with Apache.

First, Install what you need (assuming that you already have LAMP stack).

yaourt -S certbot certbot-apache acme-tiny letsencrypt-cli openssl

Next, you need to obtain the certificates. Also, I port forwarded 80 and 443 through the router to the server. This would be a good time to make sure that port forward is good or else this won’t work properly.

certbot certonly –email your.email@address.com –webroot -w /srv/http/site1/ -d www.inject.run,inject.run

If you have received the congratulations message, then you should have certificates in the designated folder. (Mine were located in /etc/letsencrypt/live/inject.run/fullchain.pem.)

Now we have to activate/use the certificates through Apache.

Edit /etc/httpd/conf/httpd.conf and uncomment the following (I use nano and ctrl+w to search):

LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf

and, while you’re in httpd.conf, search for Listen 80 and add Listen 443 right below that line.

Now, this might seem like a duplication of effort, but it was the only way I got this to work:

In /etc/httpd/conf/extra/httpd-ssl.conf, find the Virtual Host Context section, and add your VirtualHost server information as follows:

;
DocumentRoot "/srv/http/inject.run"
ServerName inject.run:443
ServerAdmin YOUR.EMAIL@ADDRESS.COM
ErrorLog "/var/log/httpd/error_log"
TransferLog "/var/log/httpd/access_log"
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/inject.run/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/inject.run/privkey.pem"
#SSLCertificateChainFile
"/etc/letsencrypt/live/inject.run/chain.pem"
#SSLCACertificatePath "/etc/httpd/conf/ssl.crt"
#SSLCACertificateFile "/etc/httpd/conf/ssl.crt/ca-bundle.crt"

Note, the only two files you have to reference from your certificates are fullchain and privkey.

And, the last thing before you restart all of your services is to add a separate VirtualServer in your httpd-vhosts.conf file. Edit /etc/httpd/conf/extra/httpd-vhost.conf and add a second VirtualHost for the same website but with *:443 instead of *:80. Additionally, you are going to need to add your certificate information as well. Look below as an example:

     ServerName www.inject.run
     OTHER OPTIONS FOR VHOST HERE IF NEEDED



     ServerName www.inject.run
     OTHER OPTIONS FOR VHOST HERE IF NEEDED

     SSLEngine on
     SSLCertificateFile "/etc/letsencrypt/live/inject.run/fullchain.pem"
     SSLCertificateKeyFile "/etc/letsencrypt/live/inject.run/privkey.pem"

Notice I added the SSL stuff in the second VirtualHost entry.

Now, if you chose, you can remove everything from the non-encrypted VirtualHost and add the following line below the ServerName to redirect all traffic to secure connections.

Redirect / https://www.inject.run/

Hopefully, this helps get your SSL encryption working.