Detect Missing EOF

While editing files on GitHub/Gitlab, missing an empty line at the bottom of a file in the buffer will result in no newline at the end of file. In the case of regular text files, this isn’t consistent with the POSIX standards. for file in `git ls-files`; do grep -Iq . $file && if ! newline_at_eof $file; then; else echo $file; fi done Fred has provided a shell script for detecting EOF on Stack Overflow. [Read More]
Linux 

Find Files for Rename

Background Three years ago, I wrote Used More Bash Utilities for batch renaming files. One of my Facebook friends has pointed out that it fails for file names containing whitespace. Problem Recently, I would like to remove the extension name .sh of all shell scripts in ~/bin, so that which {script} will work without .sh. Method A for loop over $(ls) is a basic solution, but find is more correct since it’s possible that a file name contains a space character. [Read More]
Linux 

Install Julia From Source

Custom built Julia from GitHub

Goal To get Julia installed as a normal user on RHEL 6. Motivation “Julia talks like Python but walks like C.” To do statistics more efficiently. The compiled binaries often contain install scripts which put files to shared folders under /usr. Consequently, they have to be run as sudo privileges. That drove me to start this lengthy Julia compilation. Installation Without sudo privileges, I’ve chosen to compile Julia from source. [Read More]
Linux  Julia 

My First RHEL Experience

Package installation as a normal user

Introduction This article records my errors and difficulties encountered on the first day I came across Red Hat Enterprise Linux 7 in my school’s laboratory, as a normal user without sudo privileges. The login screen was gdm, and the desktop environment was GNOME. IBus was used as the input engine. Packages installed The principal goal is to install tools that I usually use on RHEL without sudo permissions. To do so, I’ve downloaded the executable binaries or source code of these packages. [Read More]
Linux  RHEL 

Copy File and Preserve Path

Two bash solutions

Background While making changes to a theme for a static site generator, I changed files under a Git submodule included in the repo for my blog. (e.g. themes/beautifulhugo) That’s ideal for local testing, but not for version control. As a result, I cloned the repo for the theme to a directory separate from the one for my bloge (say, ~/beautifulhugo), and commit the changes there, then performed a Git submodule update so as to make the workflow clean. [Read More]
Linux 

CJK on Ubuntu 18.04

Support multilingualism on Linux and become plurilingual

Goal To enable Chinese and Japanese input on (X)ubuntu 18.04 laptops . My choices of input method old new OS Xubuntu 18.04 Ubuntu 18.04 Desktop Environment Xfce GNOME Input method Fcitx IBus   Language Method 中文 Rime 日本語 Mozc On my old Fujitsu laptop running Xubuntu, I’ve chosen Fcitx. [Read More]
Linux  CJK 

Ubuntu 18.04 Installation on Fujitsu AH557

Ubuntu installation on hybrid system

Objective To get a hands-on experience on Ubuntu installation on a UEFI hybrid system. Devices 120 GB SSD disk: /dev/sda 1 TB HDD disk: /dev/sdb 8 GB USB key: /dev/sdc Stage 0: precautions Ensure that your machine has enough power. Disable Secure Boot in M$ Windows Disable Quick Boot in boot menu Stage 1: Make your live USB key I tried Xubuntu’s built-in disk writing tool to create a live USB key from the official ISO file. [Read More]

Brightness Key on Linux

Adjust brightness on Xubuntu 18.04

Problem One can use xrandr to adjust screen brightness. However, the factor (default to 1.0) is relative to the current brightness. How to enable the brightness adjust keys / on the keyboard under Xubuntu 18.04? Solution Toz’s post on Ubuntu Forum works like a charm. The default value for GRUB_CMDLINE_LINUX is an empty string. Changing it to acpi_backlight=vendor and updating the GRUB has solved the problem since the next boot. [Read More]