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 

Git URL Shortener Exception

A URL lengthened by git.io

Due to limitations on the number of characters imposed by the site owner, URL shorteners are useful for shortening comments containing URL(s). Nonetheless, while commenting on my recent PR for Introduction, I found that GitHub’s URL shortener had lengthened the URL for GitHub’s home page.

github home page short url

Output of "https://github.com" by GitHub's URL Shortener

A counterexample of GitHub's URL Shortener

Compare these two URLs.

https://github.com
https://git.io/xE9D
GitHub 

SCSS to SASS Converter

Background While porting Minimal Mistakes and Beautiful Hugo’s Staticman support to Introduction, I searched for “SCSS to SASS” on DuckDuckGo. The search engine returned results on “CSS to SASS/SCSS” or vice versa. The first theme has Staticman code in SCSS. That would fit into the third theme’s directory structure, which puts SASS files under assets/sass. However, SASS doesn’t have curly braces {}. I feared that after hours of tedious manual replacement, the code would fail to run. [Read More]
SASS  SCSS 

Merge GitHub Pull Requests

Aim To merge a pull request. How? Let’s take Staticman PR 231 as an example. I would like to test it before commiting this merget to Heroku. $ cd ~/staticman $ git branch -a * deploy dev master ... $ git remote -v eduardoboucas https://github.com/eduardoboucas/staticman.git (fetch) eduardoboucas https://github.com/eduardoboucas/staticman.git (push) heroku https://git.heroku.com/staticman3.git (fetch) heroku https://git.heroku.com/staticman3.git (push) ... $ git pull eduardoboucas pull/231/head:deploy remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. [Read More]

Enlarged /var Partition

Used GParted to grow /var partition

Background I’ve installed Ubuntu 18.04 on my new laptop. Problem The /var partition was too small. The system complained that only 200 MB was left. Solution Rebooted with my live USB. Opened GParted. Moved /tmp partition to the left and grew it to 6 GB. Grew /var partition to 16 GB Click Results Details [TL;DR] Here’s the GParted generated log. GParted Details GParted 0.30.0 --enable-libparted-dmraid --enable-online-resize Libparted 3.2 Move /dev/sdb4 to the left and grow it from 3. [Read More]

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. I was too lazy to get the dependencies fixed. [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 

PDF Form Printing Error

How to avoid wasting paper?

Background Le Temple du Marais "Eglise verte" means "green church". My churches are going green. Problem → I downloaded a PDF from Haute-Garonne’s government site, filled in the form and saved it on a USB key. Then I printed it at a Konica Minolta bizhub photocopier yesterday. However, _only_ the radio buttons and checkboxes were printed. The blanks were left _blank_! I opened my PDF and double-checked that I had input the text in . [Read More]