Tagged: git

Exploring with Gentoo Linux (Part 3)

Part 3 - Setting up i3 Window Manager

It's been a couple of years since I started using Tiling Window Manager. I first started with Awesome because it's said that this window manager was somewhat between floating and tiling window manager. It uses Lua to configure the system. It's not the easiest language to learn, but not the most difficult one, either. I liked it but I found a bit cumbersome to arrange windows the way I wanted. So, I migrated over to i3.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

I love i3 for its simplicity and text based configuration file. It's fast, powerful and supports multi-monitors well. I don't think I can go back to any other Window Managers anymore.

X11:

Updated: Updated article about X11

To use i3 Window Manager, X Window System needs to be installed. # emerge --ask x11-base/xorg-drivers # emerge --ask x11-base/xorg-server

When the installation is finished, some environment variables will need to re-initialized before continuing. Source the profile with this command:# env-update # source /etc/profile

NVIDIA Driver:

Updated: Updated article about NVIDIA Driver

I have a rather old NVIDIA GeForce GTS 450. For some reasons, the latest drivers from the nvidia website always doesn't work even though it says its compatible with my graphic card. So, I use the one I know it works from before.# sh NVIDIA-Linux-x86_64-390.116.run

i3 Window Manager:

The installation of i3wm is straight forward.# emerge --ask x11-wm/i3

After i3wm is successfully installed, we need a way to execute it and get into i3 window environment. To do this, ~/.xinitrc needs to be created. This is the file when startx and xinit are run and execute it. If this file is not present, startx run the default from /etc/X11/xinit/xinitrc.$ nvim ~/.xinitrc ========== exec i3

Then, we need to update ~/.xinitrc to load ~/.Xresources automatically each time startx is executed so the config is loaded into urxvt.$ nvim ~/.xinitrc ========== [[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources exec i3

Rofi:

Rofi is a window switcher, run dialog, ssh-launcher and dmenu replacement that I've been using since the day I switched to i3 Window Manager.# emerge x11-misc/rofi

i3pystatus:

Installation of i3pystatus is straightforward. To display icons, I'd need Font Awesome installed.# emerge --ask media-fonts/fontawesome

Then, install pip, Python's package management system.# emerge --ask dev-python/pip

Using pip, i3pystatus can be installed. The --user option is needed because I'm installing it as a regular user. This will install it user's $HOME directory ($HOME/.local/): $ pip install --user i3pystatus

As mentioned before, i3pystatus was installed under $HOME/.local/bin/, this needs to be added to $PATH.

Finally, install some modules to display volume, memory usage, disk usage, network status, etc.

Updated: Updated article about Python Modules
$ pip install --user colour \ netifaces \ psutil

New: Pop-up Calendar Applet

gsimplecal:

I wanted a simple calendar applet to pop up when the date/time field in i3pystatus is clicked. What I was looking for is something simple, small, and lightweight calendar app, and narrowed down to Orage and gsimplecal. Orage is from XFCE, known its lightweight desktop environment, and gsimplecal is written in C++ using GTK for OpenBox. Both are simple and lightweight, but I decided to use gsimplecal because I can control its behavior from a config file.$ cd /tmp $ git clone git://github.com/dmedvinsky/gsimplecal.git $ cd gsimplecal $ ./autogen.sh $ ./configure $ make ... Unique.cpp:7:10: fatal error: sys/sysctl.h: No such file or directory 7 | #include <sys/sysctl.h> |

At this point, it failed on my system because sysctl.h is under /usr/include/linux/ directory. To fix this issue, simply edit the affected Unique.cpp under gsimplecal/src/ directory.

After correcting the path for the header file, re-run the make command and continue installing the app$ make $ make install

Then create a config file under ~/.config/gsimplecal/ and enter the following config values:$ mkdir ~/.config/gsimplecal $ cd ~/.config/gsimplecal/ $ nvim config ================== show_calendar = 1 show_timezones = 1 mark_today = 1 show_week_numbers = 1 close_on_unfocus = 0 external_viewer = sunbird \-showdate "%Y\-%m\-%d" clock_format = %a %d %b %H:%M force_lang = en_US.utf8 mainwindow_decorated = 0 mainwindow_keep_above = 1 mainwindow_sticky = 0 mainwindow_skip_taskbar = 1 mainwindow_resizable = 0 mainwindow_position = none mainwindow_xoffset = 1690 mainwindow_yoffset = 845 clock_label = Local clock_tz = clock_label = Tokyo clock_tz = :Asia/Tokyo clock_label = Taiwan clock_tz = :Asia/Taipei

The last step is to integrate gsimplecal to i3pystatus.$ nvim ~/.config/i3/pystatusconfig.py ================== ... status.register("clock", format="%b %e (%a) %H:%M %p ", color="#fffff3", interval=1, on_rightclick="gsimplecal", on_leftclick="gsimplecal", ) ...

That's all!
-gibb

Exploring with Gentoo Linux (Part 2)

Part 2 - Configuring Other Applications

Git:

Git is distributed revision control and source code management software. I need to install git first because I have dotfiles and config files for the applications I need. # emerge --ask dev-vcs/git

After the installation, following config settings need to be done at least.$ git config --global user.name "my_username" $ git config --global user.email "my_email"

Then, download the dotfiles from Github.$ cd ~/ $ git clone https://github.com/ubyt3m3/dotfiles.git ... $ ls dotfiles

st:

st is a simpke terminal for X. I use this terminal until I finish setting up urxvt. savedconfig USE flag lets you save a customized configuration file to /etc/portage/savedconfig/x11-terms/st.# echo "x11-terms/st savedconfig" > /etc/portage/package.use/st # emerge --ask x11-terms/st

Rxvt-unicode:

Rxvt-unicode (urxvt) is THE terminal emulator that I must have in my work environment since OpenBox days. It's fast, lean, highly customizable and can display different fonts. I have another post regarding how I customize it.

Gentoo Linux allows you to choose what options to enable or disable using the USE flags. The options I wanted to enable were the followings:

  • 256-color: Enable 256 color support
  • unicode3: Use 21 instead of 16 bits to represent unicode characters
  • xft: Build with support for XFT font renderer (x11-libs/libXft)
  • gdk-pixbuf: Build with support for image loading and manipulation. Need this for image previewing in ranger

There are a few ways to do this in Gentoo. Since I wanted to do per package base, I set it in the /etc/portage/package.use/ directory:# echo "x11-terms/rxvt-unicode 256-color unicode3 xft gdk-pixbuf" > /etc/portage/package.use/rxvt-unicode # emerge --ask x11-terms/rxvt-unicode or set it during the installation:# USE="256-color unicode3 xft gdk-pixbuf" emerge --ask x11-terms/rxvt-unicode

Its config file is ~/.Xresources.

Updated: Updated article about Xresources

Neovim:

Neovim is a fork of Vim that promised to fix issues with Vim and provide a better out-of-the-box experience for Vim users. It also includs a built in terminal emulator.

Installation is simple.# emerge --ask app-editors/neovim

Its configuration file is in ~/.config/nvim/init.vim and I use vim-plug plug-in to handle installation of other plug-ins. Once my init.vim is copied to its config directory, run nvim. It should install defined plug-ins automatically. If it doesn't, go into the Normal/Command mode by hitting Esc. Then type :PlugInstall. This should trigger installation of plug-ins.

PCManFM:

PCManFM is a GUI file manager. It's light weight and has features like displaying mounted drives and dual panes. I don't usually use it but it's good to have as a backup.# emerge --ask x11-misc/pcmanfm

Faenza Icons and gtk2 theme:

Faenza is an icon theme for Gnome. I've looked around and liked it the most. It can be installed from Portage. # emerge --ask x11-themes/faenza-icon-theme

Icons and GTK2 theme can be applied from lxappearance, but it needs to be installed first. # emerge --ask lxde-base/lxappearance

My customized Morning Glory needs to be extracted to ~/.themes/.$ tar -xzvf MorningGlory.tar.gz -C ~/.themes/

Once the icons and theme have been prep'ed, run lxappearance to apply them.

For the theme, click on the Widget tab. Morning Glory should be listed in the left pane.

Icons

For the icon theme, click on the Icon Theme tab, and choose Faenza from the list in the left pane.

Ranger:

Ranger is a text-based file manager. The best feature for me is the vi-style keybinding. # emerge --ask app-misc/ranger

The default directory is ~/.config/ranger/ and you can copy the default configuration files to this directory.$ ranger --copy-config=all

Copied files are the followings:

  • rc.conf - startup commands and key bindings
  • commands.py - commands which are launched with :
  • rifle.conf - applications used when a given type of file is launched.

For image preview, w3m needs to be installed.# emerge --ask www-client/w3m

Then, enable image preview in ranger's config file, ~/.config/ranger/rc.conf.$ nvim ~/.config/ranger/rc.conf ================================== ... set preview_image true ... set preview_images_method urxvt

Cmus:

Cmus is a small, fast and powerful console music player. # emerge --ask media-sound/cmus

TO DOs: set ups

Scrot:

Scrot is a command line screen capture utility.# emerge --ask media-gfx/scrot

Neofetch:

Neofetch is a bash script that displays the system information such as installed OS, kernel version, CPU, memory, etc... next to an ASCII operating system logo.# emerge --ask app-misc/neofetch

Chromium

Chromium is a free and open-source web browser from Google. It features a minimal user interface, powerful web development tools, and a built in task manager. There is a proprietary version of browser called Google Chrome

with more features than Chromium.# emerge --ask www-client/chromium

Be warned: Compiling Chromium can take a significant amount of CPU time and system memory, and it took nearly 7 hours to complete compiling.

Fonts:

I use following fonts for urxvt and i3.

  • Inconsolata
  • Kochi (for Japanese)
  • Font Awesome (for font icons)
  • Deja Vu
# emerge --ask media-fonts/inconsolata # emerge --ask media-fonts/kochi-substitute # emerge --ask media-fonts/fontawesome # emerge --ask media-fonts/dejavu

That's all!
-gibb

Exploring with Gentoo Linux (Part 1)

Part 1 - Base System

In my previous post, I mentioned that my 10-year-old PC went haywire and upgraded some components to fix them. One of them was the main hard disk that had Slackware installed. I replaced it with a new SSD disk, hoping to get some speed in processing (my PC was so old that I'm not expecting much of speed boost). Since my primary drive needed a replacement, I had to install new OS on it. I was thinking of putting Slackware as usual but it got me thinking a bit. Its last release was 4 years ago. I love its simplicity and stable build but didn't feel like installing a 4-year-old OS.

Gentoo Linux

I've tried Debian, Arch, and Manjaro Linux before, but I always came back to Slackware before I knew it. While debating whether to put Slackware 14.2 again, I came across with Gentoo Linux. I knew the existance of Gentoo Linux and you'd need to compile every package, like Ports in FreeBSD. Well, I wanted to start a new so I decided to give it a try to see how I'd like it.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Installation:

I wanted the set up of my work environment be the same as what I had before (See Building My Work Environment (Part 1)), so most of applications that'll be installed will be the same. At any rate, the installation of Gentoo was a bit of trial and error, and it took quite a while to get it installed. I'll leave the steps to its Handbook, but its installation procedure is not a menu driven, like other distos. It involes a lot of typings. It reminded me of the Arch Linux installation.

Even Slackware installation is a console menu based, so that makes a big difference between these two distros. I would think the installation procedure for Gentoo or Arch is more flexible.

Partition/filesystem Schemes:

I have this 256GB SSD as a primary disk and 1TB SATA disk for /home. The SSD disk was brand new so I partitioned it as follows with parted;

PartitionSizeFSDescription
/dev/sda12MiB-BIOS boot partition
/dev/sda2128MiBext2Boot partition
/dev/sda34295MiBSWAPSwap Partition
/dev/sda4239970MiBext4/ Partition
Updated: Updated article about Partition Schemes

For the secondary disk, I converted its partition table to gpt and created one partition for /home.

PartitionSizeFSDescription
/dev/sdb1953868MiBext4/home partition

This below is my /etc/fstab. I have /var/tmp and /var/tmp/portage as tmpfs. I took an advice from Portage TMPDIR on tmpfs in Gentoo wiki.

/dev/sda2/bootext2defaults,noatime0 2
/dev/sda3noneswapsw0 0
/dev/sda4/ext4noatime,errors=remount-ro0 1
/dev/sdb1/homeext4defaults1 2
tmpfs/tmptmpfsnoatime,nodev,nosuid,size=10G0 0
tmpfs/var/tmptmpfsrw,nosuid,noatime,nodev, size=15G,mode=17770 0
tmpfs/var/tmp/portage tmpfsrw,nosuid,noatime,nodev,size=15G, mode=775,uid=portage,gid=portage, x-mount.mkdir=7750 0
Updated: Updated article about /etc/fstab

SSD Optimization:

Some of websites mention the use of discard mount option in fstab, but as SSD from Gentoo wiki and Solid State Drive from Archwiki stated, using the discard mount option is called continuous TRIM and it's not recommended. Instead, it suggests to run fstrim periodically. So, that's what I did using cron.# crontab -e =================================== # Global variables SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # For details see man 5 crontab # Example of job definition: # .---------------- minute (0 - 59) # |  .------------- hour (0 - 23) # |  |  .---------- day of month (1 - 31) # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # |  |  |  |  | # * * * * * user-name command to be executed 15 04 * * 6 /sbin/fstrim /

XDG cache on tmpfs:

Many X Window System programs, such as Chromium, Firefox, etc..., make frequent disk I/O every few seconds to cache. To reduce strains to SSD, the default cache location can be changed to tmpfs. The default cache location is ~/.cache and this is HDD for my case but I sent it to tmpfs anyway.# nvim /etc/profile.d/xdg_cache_home.sh ============================================ if [ $USER ]; then export XDG_CACHE_HOME="/tmp/${USER}/.cache" fi

make.conf:

/etc/portage/make.conf is used to customize the Portage environment for the entire system (not per package or user). The settings defined in this file will be applied to all packages that are being installed (or emerged). So far, these are my custom settings: # cat /etc/portage/make.conf ================== CFLAGS="-march=native -O2 -pipe" ... # The number of parallel make jobs that can be used MAKEOPTS="-j7" # USE flags USE="-emacs -kde -gnome -bluetooth alsa" # Language codes for US English and Japanese L10N="en en-US ja"

X11:

If startx can't be found, it most likely X11 didn't get installed. # emerge --ask x11-base/xorg-server

System Logger:

During the installation, I chose to install system logger (app-admin/sysklogd) and this may display the following messages in console:

sysklogd: /dev/xconsole: No such file or directory

When the message starts to appear, updating its configuration file should solve it. # nvim /etc/syslog.conf ============ ... #daemon.*;mail.*;\ # news.err;\ # *.=debug;*.=info;\ # *.=notice;*.=warn |/dev/xconsole

ALSA Issues:

I have another post with more details about issues with ALSA sound, but to sum it up,I need to enable SND_HDA_CODEC_CONEXANT in the kernel options. The HD-audio component apparently consists of two parts, the driver and codec, and correct options need to be enabled.

eix:

eix is a set of utilities for searching and diffing local ebuild repositories using a binary cache. This is used to audit installed packages for maintenance. Use eix Gentoo wiki for how to set it up. # emerge --ask app-portage/eix

New: Some system utilities are added below.

smartmontools:

smartmontools is a utility to read and monitor the S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology) information of ATA/SATA and SCSI/SAS drives. Use Gentoo wiki: smartmontools for how to set it up. # emerge --ask sys-apps/smartmontools

lshw:

lshw is a hardware detection utility to report various hardware components. # emerge --ask sys-apps/lshw

To display connected storage devices, run below command: # lshw -class disk -class storage ========================= ... *-scsi:0 physical id: 1 logical name: scsi0 capabilities: emulated *-disk description: ATA Disk product: Samsung SSD 860 physical id: 0.0.0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: 1B6Q serial: S5GANE0MB00832Y size: 238GiB (256GB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=2d257117-5180-48d2-be63-3222d90a37e9 logicalsectorsize=512 sectorsize=512 ... *-scsi:2 physical id: 3 logical name: scsi2 capabilities: emulated *-disk description: ATA Disk product: WDC WD10EZEX-75W vendor: Western Digital physical id: 0.0.0 bus info: scsi@2:0.0.0 logical name: /dev/sdb version: 7113 serial: WD-WCC6Y4PE55J2 size: 931GiB (1TB) capabilities: gpt-1.00 partitioned partitioned:gpt configuration: ansiversion=5 guid=189d3b93-af3e-47e2-8ed2-975eb9ed4ec0 logicalsectorsize=512 sectorsize=4096

Things To Be Installed:

Fonts:
  • font-awesome
  • Kochi (Japanese)
  • Inconsolata

Icons:
  • Faenza

File Manager:
  • pcmanfm
  • ranger

Music:
  • cmus - Console based music player

Terminal:
  • rxvt-unicode

Text Editor:
  • Neovim

Themes:
  • lxappearance - Change GTK based themes
  • nitrogen - Set wallpapers
  • My customized Morning Glory theme

Version Control:
  • git

Virtualization:
  • virtualbox

Web Browser:
  • chromium

Window Manager:
  • i3
  • i3pystatus - Replacement for i3status
  • rofi - Replacement for dmenu

Others:
  • scrot - Command line screen capture
  • neofetch - ASCII art to show logo and system info

That's all!
-gibb

Termux is the ONE for Android!

Ever since I learned Terminal IDE was not supported for Android 5.0 Lollipop, I was heartbroken because there weren't any git client programs as good as git on Terminal IDE. I was using SGit but wasn't really happy because of lack of flexibility, features, and ease of use.

However, I finally found the one that works today! It's called Termux. Termux is a terminal emulator, just like Terminal IDE, but it comes with an extensive Linux package collections you can install and manage packages you want. Of course, it has git in its collection. So, I can say "bye, bye" to SGit now.

IMHO, Termux is for Android 5.0 Lollipop and above, and Terminal IDE is for Android 4.4 Kitkat and below.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibility of end result after following these steps (although I will try to help if you send me your questions/problems).

Ok, the installation and configuration of Termux and git were easier than those of Terminal IDE in my opinion. Termux comes with a minimum base system. At this point, it doesn't do much so you'd need to install some packages. After getting Termux installed on my Galaxy Note 4, I opened it and typed below to update packages: $ apt update

With a bunch of messages, packages are updated. Then ran the following command to install git: $ apt install git

No problem here. I then installed ssh. As you may know, bitbucket.org offers two ways to access a git repository, https and ssh. I could go either way, but ssh is such a useful utility. So, I installed it at this time: $ apt install openssh

Now, the fun part starts - configuration. I've set up my web server Bit Web Server to look into /sdcard/www/ for source codes, so I tried to clone codes from my git repo, but it failed with "Permission Denied" error. Hmm... is this because Termux doesn't have write permissions for security? Well, no problem. I can seem to clone into /data/data/com.termux/home/ and copy the source codes into /sdcard/www/: $ git clone https://[user_name]@bitbucket.org/[repo_name]/[repo_name].git $ cp -r [repo_name] /sdcard/www/

After copying into the www directory, I learned that I can still run git commands like git push, git pull, etc... without any errors. Fantastic!! This means I don't need to copy back and forth between /data/data/com.termux/home/ and /sdcard/www/ every time I make updates.

Now, it's time to finish up by configuring git and Termux's user home environments.

For git, ran the following commands to set up user information: $ git config user.name "[username]" $ git config user.email "[username]@[server]"

Then edited the .bashrc file for some aliases. I created ~/.bashrc with some start up configurations for the shell, but it didn't seem to be taking it after restarting Termux. After poking around, I found a bashrc file that seems to be globally used for Termux in /data/data/com.termux/files/usr/etc/: $ cd /data/data/com.termux/files/usr/etc/ $ vim bash.bashrc --------------------------------- export GIT_AUTHOR_NAME="[username]" export GIT_AUTHOR_EMAIL="[username]@[server]" export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL PS1='\[\e[00;32m\]\A \[\e[00;91m\]\u\[\e[01;93m\]@\h\[\e[00;37m\][\[\e[01;34m\]\w\[\e[00;37m\]]\n\[\e[47m\]\[\e[1;30m\]$\[\e[00m\] ' set -o vi

With all of these, git is ready for Android 5.0 Lollipop!

That's all!
-gibb

Getting git working on Galaxy Note 4

Yes! I finally received Samsung Galaxy Note 4 - Frost White on 11/3/2014, a little more than week later than proposed shipping date from Verizon. Galaxy Note 4 is an amazing, amazing device. It's super fast and its display is just gorgeous. There are so much to say about this phone but for full reviews and specs, you can always "Google It".

At any rate, after a few days of playing with it, naturally, I decided to make it my web development device in place of old Thunderbolt. So, I started following my own blog, Getting git Working on Android Device. But when I tried to make a test connection to bitbucket.org, I got following error: $ ssh -T git@bitbucket.org ssh: connection to git@bitbucket.org:22 No auth methods could be used.

Hmm... what's going on? I started digging and found that I forgot to mention registering the public key to bitbucket.org. Oops. After a year of its original post, I found a missing step in my post. How embarrassing! I made a correction so hopefully all make sense now.

Since I have all the steps and explanation in Getting git Working on Android Device, I won't go into details of each step again, but instead, I'll list the summary of commands used to make it happen: //OPEN Terminal IDE $ git --version git version 1.7.8.163.g9859a.dirty $ mkdir ~/.ssh $ dropbearkey -t rsa -f ~/.ssh/id_rsa $ dropbearkey -y -f ~/.ssh/id_rsa $ vim ~/.bashrc --------------------------------- alias ssh='ssh -i ~/.ssh/id_rsa' $ vim /data/data/com.spartacusrex.spartacuside/files/bin/ssh_git --------------------------------- #!/data/data/com.spartacusrex.spartacuside/files/system/bin/bash exec ssh -i ~/.ssh/id_rsa "$@" $ chmod 755 /data/data/com.spartacusrex.spartacuside/files/bin/ssh_git $ vim ~/.bashrc --------------------------------- export GIT_SSH=~/bin/ssh_git $ dropbearkey -y -f ~/.ssh/id_rsa | grep "^ssh-rsa" > ssh_key //COPY THE PUBLIC KEY TO bitbucket.org and Restart Terminal IDE $ ssh -T git@bigbucket.org logged in as [username]. You can use git or hg to connect to Bitbucket. Shell access is disabled. $ ln -s /mnt/sdcard/www www && cd www $ git clone git@bitbucket.org:[username]/[repository_name].git $ vim ~/.bashrc --------------------------------- export GIT_AUTHOR_NAME="[username]" export GIT_AUTHOR_EMAIL="[username]@[server]" export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL

That's all!
-gibb

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others. I will NOT take any responsibilities of end result after following these steps (although I will try to help if you send me your questions/problems).