Zhixian's Tech Blog

2020-03-29

Setting TextEdit as default Git editor

Filed under: Uncategorized — Tags: , , , , , , — Zhixian @ 09:41:03 am

This blog post describes how to set the default Git editor in MacOS to use the default text editor that comes with MacBook, TextEdit.

Sections

  1. Scenario
  2. Solution

Scenario

By default, Git would use vi as the default text editor for commit messages.

Git commit
Using vi to add commit messages

However, you might prefer to use a text editor with a graphical interface to write your commit messages.

Solution

For a task like adding commit messages, we want to use a text editor that is as simple as possible that is fast to startup and close. On a MacBook, that editor is probably the text editor that comes out of the box, TextEdit.

To configure TextEdit as the default text editor for Git, type the following at the command-line:

git config –global core.editor “open -e -W -n”

Executing command to use TextEdit for Git

After you executed the command, the next time you do a Git commit, it you would use TextEdit.

TextEdit to edit commit messages

Aside

You might be wondering what’s the “open -e -W -n” about.

open is a command in MacOS used open files and applications.

-e tells the command to open files using TextEdit

-W tells the command to wait till TextEdit is closed.

-n tells the command to open a new instance of TextEdit

2018-12-08

Install .NET Core 2.2 on Ubuntu 18.04

Filed under: computing, ubuntu, Uncategorized — Tags: , , — Zhixian @ 09:40:12 am

About

This is a note to self about installing the .NET Core SDK 2.2 on Ubuntu (because the instructions on Microsoft website does not work / is incomplete).

Scenario

When the .NET Core 2.2 SDK release was announced, I was keen to install it on my Ubuntu machine. So I went to their web site (https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-2.2.100) and and followed their instructions there.

The instructions are:

  1. Register Microsoft feed
  2. Install the .NET SDK

Which means executing the following commands at your command-line prompt:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

Unfortunately, despite following the instructions, you may find that you still could not install the latest .NET Core SDK as the package could not be found when you execute the last command! ūüė¶

Solution

To fix this issue, you need to add Microsoft’s repository:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update

After update, you should be able install .NET Core 2.2 SDK by running the following command again.

sudo apt-get install dotnet-sdk-2.2

2018-05-27

How to update your Kindle Touch firmware manually

This is a blog post describing how to update your Kindle Touch firmware manully.

The firmware is the software that runs on your Kindle Touch device. You might have to update the firmware if you did a factory reset and then found that you could not register your Kindle Touch any more. This is probably due to the system that was handling the registration of the Kindle Touch device is no longer available. You probably would see a screen like the below:

unable-to-connect

The instructions to transfer and install the software updates can be found here (as of 2018-05-27). The rest of this blog post is simply a more descriptive version of the instructions stated.

First, I note the version of the firmware that my Kindle Touch is using.
Assuming you are on the home page, this is done by clicking the menu button and select “Settings”.

go-to-settings

On the Settings page, click on menu button and select “Device Info”.

go-to-device-info

A “Device Info” dialog would popup. You can see the version of the firmware that your Kindle Touch is using on the 2nd last line of the dialog content. As stated in my screendump below, my Kindle Touch device is currently using 5.3.7.2. The latest version of the software as stated on the software updates download site here is 5.3.7.3 (as of 2018-05-27).

device-info

To update the firmware, go to thesoftware updates download site and download the firmware to your computer. This is done by going the web page and clicking the “Software Update 5.3.7.3” link as shown below:

download-updates

After you clicked the link, you should received a file named “update_kindle_5.3.7.3.bin”.
After the file is downloaded to your computer, connect your Kindle Touch to your PC.

After your PC has detected your Kindle Touch device, you should be able to open it using your file manager. Copy the the firmware update file to the root folder of the Kindle Touch device as follow:

transfer-update

After the file is copied, eject your Kindle Touch device from your computer.
You are now ready to apply the update to your Kindle Touch.
To apply the update, go to the Settings page as stated above when we wanted to check for the firmware version. Then on the Settings page, click on the menu button and select “Update Your Kindle” button.

 

update-kindle-button

A “Update Your Kindle” dialog would popup. Click on the “OK” button on the dialog to proceed with the update.

update-your-kindle2

After you clicked the “OK” button, the device will restart to apply the update.
You may see the following screen.

updating-kindle

Gradually, the update process will end.
And you will see that your Kindle Touch is updated to the version of the firmware update that you downloaded.

If you proceed to register your Kindle Touch, you should be successful this time round.

Hope this helps.

2015-11-02

Minix3 Basic Post Installation Setup

Filed under: Uncategorized — Zhixian @ 17:00:11 pm

Summary

  1. Set password for root account
  2. Set timezone
  3. Set hostname

 

Set Password for root account

By default, there is no password assigned for the root account.
You can set a password for root account using the following command:

# passwd

image

Set timezone

Before you can set the timezone, you need to identify it using the computer standards.
Look at a file /usr/share/zoneinfo for a list of timezone.

image

In my case, my country Singapore is located in Asia

image

So my timezone is determined to be Asia/Singapore.
To set the timezone, enter the follow command:

# echo export TZ=Asia/Singapore > /etc/rc.timezone

image

This will take effect when I log in again.

 

Set hostname

The default hostname can be rather non-descriptive.

image

So you might want to change that.
So for example, I chose the hostname of rocket, I would enter the following command to set it:

# hostname rocket

image

Zhixian’s note: This change does not seem to persist after a reboot. Sad smile
Still exploring how to do this correctly.
The best solution I saw so far is from http://osdir.com/ml/minix3/2011-12/msg00072.html
It suggests putting your IP and host name into /etc/hosts file.
Here’s the excerpt pertaining to problem and suggested solution:image

In case you are wondering, here’s what my /etc/hosts file look like:

image

Reference

http://wiki.minix3.org/doku.php?id=usersguide:postinstallation

2015-10-30

Installing Alpine

Filed under: Uncategorized — Zhixian @ 23:08:10 pm

I do not find the default “mail” program in Linux is not user-friendly.

Hence, I would suggest another console e-mail application.
Two applications come to mind, pine and elm.
I’m picking pine as I have slightly more familiarity with it and I think it is more user-friendly than elm.

Pine is a proprietary application owned by University of Washington. So I am picking to install the open-source version of this application call Alpine. To install Alpine type the following command:

$ sudo apt-get install alpine

After the installation has complete, type the following command to run it:

$ alpine

Changing Screen Resolution of Ubuntu on VirtualBox

Filed under: Uncategorized — Zhixian @ 23:08:10 pm

Identify the resolution that your VirtualBox environment supports.

Reboot the system and hit ‘c’ when the grub windows appears appears to access grub console. In grub console, enter the following command to see a list of resolutions (eg, 1024x768x32):

grub> vbeinfo

Edit the grub configuration file
/etc/default/grub. Uncomment the following line in the file.

GRUB_GFXMODE=1152x864x32

Replace the resolution with the one appropriate for your environment.

Save the file. Then update your grub configuration by running:

$ update-grub

Restart your virtual machine again

Reference

http://askubuntu.com/questions/456527/maximum-terminal-resolution-in-ubuntu-server-virtual-box-guest

hellorails

Filed under: Uncategorized — Zhixian @ 23:06:10 pm

This blog is about creating a first Rails web application.
Before proceeding, you need to install sqlite.

Summary of Steps

  1. Install sqlite
  2. Install nodejs
  3. Create hellorails
  4. Running hellorails

Install sqlite

To install sqlite, run the follow commands:

$ sudo apt-get install sqlite3
$ sudo apt-get install libsqlite3-dev

Note: We have to install libsqlite3-dev because we want to use add sqlite support to Rails via gem.

After sqlite is installed, we can add sqlite support to Rails by running the following command.

$ sudo gem install sqlite3 -v '1.3.11'

Install nodejs

Rails do not a built-in web server. It relies on other infrastructure to run. Here, I decide to install nodejs as I am intending to do some other nodejs development later on as well.

$ sudo apt-get install nodejs
$ sudo apt-get install npm

Creating hellorails

After all the setup is done, we can start to create our hellorails application by running the following command:

sudo rails new ./hellorails

Running hellorails

After the application is created, navigate into the directory.
You can run the application by running the following command:

$ rails server

Note: This command will start a web server listening on localhost on port 3000. What this means, is that you can only access the web application on your local machine. To allow other machines to access the web application on port 3000, you need to make the web server listen to the IP address of 0.0.0.0. This can be done by running:

$ rails server -b 0.0.0.0

An alternative to adding the parameter is edit boot.rb file in the config folder.

Reference

http://guides.rubyonrails.org/initialization.html

Installing Ruby

Filed under: Uncategorized — Zhixian @ 23:06:10 pm

Installation

$ sudo apt-get install ruby-full

This will install Ruby 1.9.3 as of this writing.

I want to do Ruby on Rails, I need to install Rails.
Rails however require “make” which is not installed out of the box.
So we need to install that first.

$ sudo apt-get install make

Apparently, it also require zlib development libraries.
You need to install it by running the following command:

$ sudo apt-get install zlib1g-dev

Before installing Rails, you may want to¬†install the “rdoc” package.
If not, you may encounter the error message “file ‘lib’ not found”.

$ sudo gem install rdoc

After installation of “rdoc” package, you can install Rails using:

$ sudo gem install -V rails

Note:¬†The “-V” parameter in the above command makes the installation process more verbose and may be omitted. If omitted,¬†it may appear as if the process is hanged as there is not visible feedback on the installation process. The download and installation process itself takes quite a while.

Alternatively, you may want to run the following command to install Rails instead. This command will not install documentation for Rails which can take some time to generate (and hence misled you to think that the process has hanged).

$ gem install rails --no-ri --no-rdoc

Reference

https://help.ubuntu.com/community/RubyOnRails

Installing FTP server

Filed under: Uncategorized — Zhixian @ 23:05:10 pm

Installation

$ sudo apt-get install vsftpd

Configuration

Edit the configuration file /etc/vsftpd.conf

Uncomment this line to allow users to be able to upload files:

write_enable=YES

Uncomment this line to limited to their home directories:

chroot_local_user=YES

Add the following line to counter the message:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()

allow_writeable_chroot=YES

Restart server

$ sudo restart vsftpd

Reference

https://help.ubuntu.com/lts/serverguide/ftp-server.html

https://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/#comment-2051

Installing Git

Filed under: Uncategorized — Zhixian @ 23:00:10 pm

Installation

$ sudo apt-get install git

Basic Setup

$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"

Reference(s)

https://help.ubuntu.com/lts/serverguide/git.html

Older Posts »

Blog at WordPress.com.