Update [2019/05/08]: Many people have been asking for the wallpaper in the above screenshot. It is from System Failure II, oil on canvas, 31x43” on r/Art.

Well, I am really fascinated by Reddit art and genuine creative ideas such as Scrolller which was made possible thanks to gazillions of art pieces scattered throughout various art subreddits. I am also fascinated by Unix philosophy and have been a *nix enthusiast for as long as I can remember. In addition to all this, the discovery of r/unixporn - realizing I am not the only one who cares about aesthetics of their Unix box - was a huge blow for me; to the point that studying the GitHub dotfiles posted along the screenshots on r/unixporn by fellow nix-enthusiast redditors felt like a day to day hubby for me.

All the while, I had a successful experiment with writing a complex piece of real-world software in pure Bash with an amazingly wide range of features for around 3.5K lines of code. The real excitement came when it made to the official FreeBSD Ports Tree. In spite of the fact that many people find Bash syntax annoyingly ugly and unmaintainable and often wonder why do people still write shell scripts by asking it on Quora, since MS-DOS 6.22 era, I did develop a certain love–hate relationship with shell scripting languages such as Batch Files, Bash, etc. Thus, still I do automate almost everything with these ancient technologies.

So, here is my fully-configurable wallpaper changer software written in bash which automagically fetches and display wallpapers from your favorite subs. It has been powering and brightening up my i3wm setup for the past eight months which led me to the conclusion that it deserves a proper introduction.

## Getting real IP addresses using Nginx and CloudFlare

[Update]: Thanks to digitaltoast for informing me about the missing real_ip_header CF-Connecting-IP; from the script and providing a patch for it.

OK, I suppose you know what CloudFlare is, and are familiar with Nginx configuration process, before we proceed any further. Just in case you don’t know, CloudFlare offers free and commercial, cloud-based services to help secure and accelerate websites. The thing is, I’m really satisfied with the services they offer except a repellent issue about logging the real IP address of your website’s visitors. Since CloudFlare acts as a reverse proxy, all connections come from CloudFlare’s IP addresses, not the real visitors anymore. Anyway, using Nginx there’s a simple workaround for this issue, which I’ll describe in the rest of this post.

## Colors Talk: A Colorful Terminal / Console

If you’ve ever used a GNU Gentoo or Funtoo Linux variant, or a live version of any of them, you may have noticed their eye-catching colorful terminal or console. Whether you’re on a virtual console or one of KDE, GNOME, XFCE, LXDE terminal apps.

When I’ve migrated from Funtoo to FreeBSD, the one thing that I’ve missed so badly was its colorful terminal. The nice thing about these colors is taht they always give you some valuable hints, e.g., currently you’re root user or a regular user, the file is a symlink (Symbolic link), executable or just a regular file.

Well, it’s pretty easy to have your own colorful terminal or console, once you’ve found out how Gentoo and Funtoo did that. Fortunately, it works on *BSD and all other Linux distros as well. So, stay with me and I’ll describe the process in the following.

## nano, Syntax Highlighting

GNU nano is my favorite text editor while I’m on console. Although, it doesn’t offer syntax highlighting by default, it comes with a decent set of syntax highlighting files. Usually, these files are exist in /usr/local/share/nano or /usr/share/nano, depending on your distro’s preference. You can enable syntax highlighting for your prefered language(s) by including related file(s) with .nanorc extension in your ~/.nanorc file.

~/.nanorc - FreeBSD
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 include "/usr/local/share/nano/asm.nanorc" include "/usr/local/share/nano/awk.nanorc" include "/usr/local/share/nano/c.nanorc" include "/usr/local/share/nano/cmake.nanorc" include "/usr/local/share/nano/css.nanorc" include "/usr/local/share/nano/debian.nanorc" include "/usr/local/share/nano/fortran.nanorc" include "/usr/local/share/nano/gentoo.nanorc" include "/usr/local/share/nano/groff.nanorc" include "/usr/local/share/nano/html.nanorc" include "/usr/local/share/nano/java.nanorc" include "/usr/local/share/nano/makefile.nanorc" include "/usr/local/share/nano/man.nanorc" include "/usr/local/share/nano/mgp.nanorc" include "/usr/local/share/nano/mutt.nanorc" include "/usr/local/share/nano/nanorc.nanorc" include "/usr/local/share/nano/objc.nanorc" include "/usr/local/share/nano/ocaml.nanorc" include "/usr/local/share/nano/patch.nanorc" include "/usr/local/share/nano/perl.nanorc" include "/usr/local/share/nano/php.nanorc" include "/usr/local/share/nano/pov.nanorc" include "/usr/local/share/nano/python.nanorc" include "/usr/local/share/nano/ruby.nanorc" include "/usr/local/share/nano/sh.nanorc" include "/usr/local/share/nano/tcl.nanorc" include "/usr/local/share/nano/tex.nanorc" include "/usr/local/share/nano/xml.nanorc"
~/.nanorc - Funtoo or Gentoo
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 include "/usr/share/nano/asm.nanorc" include "/usr/share/nano/awk.nanorc" include "/usr/share/nano/c.nanorc" include "/usr/share/nano/cmake.nanorc" include "/usr/share/nano/css.nanorc" include "/usr/share/nano/debian.nanorc" include "/usr/share/nano/fortran.nanorc" include "/usr/share/nano/gentoo.nanorc" include "/usr/share/nano/groff.nanorc" include "/usr/share/nano/html.nanorc" include "/usr/share/nano/java.nanorc" include "/usr/share/nano/makefile.nanorc" include "/usr/share/nano/man.nanorc" include "/usr/share/nano/mgp.nanorc" include "/usr/share/nano/mutt.nanorc" include "/usr/share/nano/nanorc.nanorc" include "/usr/share/nano/objc.nanorc" include "/usr/share/nano/ocaml.nanorc" include "/usr/share/nano/patch.nanorc" include "/usr/share/nano/perl.nanorc" include "/usr/share/nano/php.nanorc" include "/usr/share/nano/pov.nanorc" include "/usr/share/nano/python.nanorc" include "/usr/share/nano/ruby.nanorc" include "/usr/share/nano/sh.nanorc" include "/usr/share/nano/tcl.nanorc" include "/usr/share/nano/tex.nanorc" include "/usr/share/nano/xml.nanorc"

Note: If the file doesn’t exist, you should create it first:

$touch ~/.nanorc [Read More...] ## nano, Do Not Wrap Text GNU nano is my favorite text editor while I’m on console. However, there’s one thing about nano which annoys me: automatic text wrapping! Hopefully, there are two simple ways to overcome this. By using either -w command-line argument, or set nowrap configuration command within the file ~/.nanorc. 1. The temporary solution by using -w command-line argument, which should be used each time you run nano:$ nano -w /path/to/file

2. The permanent solution by setting off automatic text wrapping using the configuration command set nowrap, in the ~/.nanorc file:

~/.nanorc
 1 set nowrap

Note: If the file doesn’t exist, you should create it first:

\$ touch ~/.nanorc