Exploration of My First IntelliJ Project

We’ll try to stay in the project root if possible.

Find all non-hidden files to know the file structure.

$ find -path './.*' -prune -o -type f -print
./Algo-init.iml
./out/production/Algo-init/fr/eql/ai114/algo/init/demo/_1_HelloWorld.class
./src/fr/eql/ai114/algo/init/demo/_1_HelloWorld.java
  • -prune returns true for the chosen path and prevents find from descending.

  • -o means OR, so the paths matching -prune won’t pass through -o.

  • -type f selects files, not folders.

  • By default, AND is used to connect different conditions.

    [Read More]

Reuse Commands with Shell Arguments

My arguments for arguments, functions and alias

Background

We often want to test the output with different values for a parameter. Here’s an example: we have a parameter that pandoc icon pandoc uses to / compile source code files to PDF / M$ Word / etc.

rm output.html; param=0; pandoc input$param.txt -o output.html; \
echo param = $param

In practice, a parameter can be a font, the font size, etc, and there can be multiple parameters.

[Read More]
linux  tcsh 

CPU Temperature Display in Conky

Background

I’m using Conky for monitoring the system. After a system upgrade, the CPU temperatures were gone. Conky’s standard error showed the following.

Conky: can't open '/sys/class/hwmon/hwmon0/temp3_input': No such file or
directory please check your device or remove this var from Conky...

Source of message: https://bbs.archlinux.org/viewtopic.php?id=82231

An easy fix would be to adjust the following lines in .conkyrc according to the number N in /sys/class/hwmon/hwmonN containing the file temp3_input. (You may adjust the number 3 according to the number of CPU of your device.) The number of CPU can be found using grep -c ^processor /proc/cpuinfo.

[Read More]
Conky  CPU  Linux 

Right PATH to Linux

Roles of various config files

Background

Updated $\LaTeX$ version

From this $\TeX$-SE question about tlmgr, we see some advantages of installing $\TeX$Live directly from the official site:

  1. avoid errors due to outdated version of $\TeX$Live supplied by the OS’s package manager
  2. easier to manage packages with tlmgr.
  3. enjoy the newer version of $\TeX$Live not yet available in your current GNU/Linux version.

The installation took about 30 minutes and 5G in the disk. I’ve chosen a local installation as this didn’t require sudo privileges. The whole process went smooth and the system displayed a message about setting

[Read More]
Linux 

Xubuntu Screen Enlargement

Tonight, the screen of Xubuntu suddenly enlarged and blurred. Typing “xubuntu screen display enlarged” on Google, I’ve learnt that the <Alt> key and the mouse scroll wheel can enlarge/minify screen display from Ubuntu Forums.

Linux 

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. I’ve replaced bash with sh because I’m using Zsh.

[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 

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

  1. Rebooted with my live USB.
  2. Opened GParted.
  3. Moved /tmp partition to the left and grew it to 6 GB.
  4. Grew /var partition to 16 GB
  5. Click

GParted screenshot

Results

GParted result partition table

Details [TL;DR]

Here’s the GParted generated log.

[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. I just compiled it without GFortran and pkg-config under the ~/src folder.

[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. As I wanted to focus on my studies, I prefer downloading executable binaries.

[Read More]
Linux  RHEL