Screenshot tools for Ubuntu and Windows

This post introduces some handy screenshot tools for Ubuntu and Windows.

======Ubuntu

One of the powerful screenshot tool, which not only allow you to take screenshot, of any part of screen, but also allows you to edit the captured image, adding text, hiding private content by pixelating, upload an image to a hosting site and much more.

Gimp is a free and open source image editor which can be used for image manipulation, editing, resizing, retouching etc.

When you’ll open the Gimp GUI, go to File -> Create Screenshot and this menu will appear and you can select the option you want, whether to take screenshot of whole or part of screen.

After this, the snap of image created will be available on the GUI for editing, where you can edit the image, apply effects and so on.

(See the references section for more options for Ubuntu.)

======Windows

FastStone Capture works on XP, Vista, Windows 7, Windows 8.x and Windows 10.

References:

5 Tools to Take or Capture Desktop Screenshots in Ubuntu Linux (pdf)

Usage tips for Google docs and sheets

This post provides some useful tips for Google Docs and Sheets.

======Google doc related tips

  • Add outline (show outline)

 

 

  • Print a Google Doc with Comments

File / Download As / Web Page

An HTML file will be downloaded onto your computer. Open that HTML file in a web browser and you will see the text of the Google Document with footnotes for each of the comments. you can print this html file as pdf, and it will have comments at the end of your pdf file.

  • Change the default style of headings in Google doc

I do not like the default heading style in Google doc, so I would like to change it to my preferred heading styles. See below for the steps of how to do that:

  • Open a Google doc
  • Select the text of Heading 1, and change the style (e.g., Times new roman, font size, bold) you prefer for Heading 1

  • Go to the menu Format/Paragraph styles / Heading 1/ Update ‘Heading 1’ to match (see the pic below)

You will see all the Heading 1 format updated as the one you set above. Do the same for the rest levels of headings.

  • If you want to make the heading style that you have set just now the default one for Google docs, be sure to use Format/Paragraph styles /Options/Save as my default styles (see the pic below).

  • Interactive Checklists in Google Docs

See below for the steps about how to create interactive checklists in your Google docs.

  • Type the items — each item per line.
  • Select all the lines of items.
  • Click the down arrow to the right of the “Bulleted list” icon in the toolbar, and then choose the checkbox option from the pop-out menu.

  • Alternately, we can click “Format” in the menu, then “Lists”, then “Bulleted list”, and finally choose the checkbox option.

  • This will place a checkbox before each line in the list.

See the steps below for how to mark the checklist off  when we complete them. This can be done by changing a checkbox to a checkmark.

  • Left-click  on a checkbox — the entire group of checkboxes will be selected.
  • Left-click again on the same checkbox — this will allow us to just select the single checkbox we have clicked.
  • Right-click on that checkbox.
  • A window will pop up, click and choose the check mark (shown in red box in the pic below)

  • The empty checkbox will now be replaced with a check mark sign, indicating the item has been completed.

  • Repeat as needed for the rest of checkboxes.

======Google sheet (spreadsheet) related tips

  • Freeze or unfreeze columns & rows in your Google spreadsheet
  1. Open a spreadsheet and select a cell in a row or column you want to freeze.
  2. Open the View menu.
  3. Hover over Freeze.
  4. Select one of the options to freeze up to ten rows, or five columns.

References:

 

Run a shell script at startup / reboot

This post introduces how to auto run a shell script when your machine reboot.

We can set a crontab for this.

The crontab (short for “cron table”) is a list of commands that are scheduled to run at regular time intervals on your computer system. The crontab command opens the crontab for editing, and lets you add, remove, or modify scheduled tasks.

Just have a line added to your crontab.

Make sure the sh file is executable (you can use the following command to make the file executable)

$ chmod +x /path_to_you_file/your_file

To edit crontab file, enter the following command in your terminal:

$ crontab -e
# Edit your crontab.

The line you need to add:

@reboot  /path_to_you_file/your_file

for example,

@reboot  /home/user/test.sh

after every startup it will run the test.sh script.

To save and exit your crontab from vim,

 

Use the following command to confirm that it is actually been set.

$ crontab -l
# Display ("list") the contents of your crontab.

this will show @reboot sh $HOME/test.sh

To see whether the app that the .sh starts is actually running, you can use ps -ef (check here for more details about ps -ef).

Reboot the server to confirm whether it all works.

References:

Linux crontab command (PDF)

Linux at, batch, atq, and atrm commands (PDF)

How to run a shell script at startup (PDF)

Change folder permissions and ownership from command line

This post shows how to change permission and ownership from command line on Linux OS.

Use chown to change ownership and chmod to change permission.

The -R option makes them change the permissions and ownership for all files and directories inside of the given directory.

The following command will change ownership (both user and group) of all files and directories inside your_directory and including your_directory itself:

$ sudo chown -R username:group your_directory

And the following command will only change the permission of the folder directory but will leave the ownership of the files and folders inside the directory not changed:

$ sudo chown username:group your_directory

Note that you need to use sudo to change the ownership from root to yourself.

To make the current user own everything inside the folder (and the folder itself), use the following command:

$ sudo chown -R $USER your_directory

$ sudo chown -R $USER:$USER your_directory

For more commonly used Linux commands, check my other posts at here  and here .

Download files using Shell script

This post provides instructions on how to download files using Shell script.

To download a number of files that have similar file path, see an example as follows:

http://example.com/path/to/file1.csv
http://example.com/path/to/file2.csv
http://example.com/path/to/file3.csv
http://example.com/path/to/file4.csv
.
.
http://example.com/path/to/file4999.csv
http://example.com/path/to//file5000.csv

Method 1: 

$ wget http://example.com/path/to/file{1..5000}.csv

Method 2:

write a shell script as the following:

for i in {1..5000}
do
wget http://example.com/path/to/file$i.csv;
done

 

For more commonly used Linux commands, check my other posts at here  and here .

PostgreSQL resources

This post provides resources about PostgreSQL DB. (Check here for other DB resources.)

PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance. As a database server, its primary functions are to store data securely and return that data in response to requests from other software applications.

PostgreSQL:

PostgreSQL psql Commands:

The primary front-end for PostgreSQL is the psql command-line program, which can be used to enter SQL queries directly, or execute them from a file. In addition, psql provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks; for example tab completion of object names and SQL syntax.

 

PostgreSQL with JSON: