0

Ubuntu: know your tools

Nowadays, Ubuntu is becoming more and more popular and easier to use. It is now the main operating system of not only programmers but also normal users. In this article, I just want to share some trick and tools I often use, hope it help you to work more effectively.

1. Screenshot, screen recorder tools

Ubuntu has built-in application called Screenshot help you to capture your screen. You can open the application by searching in Dash or access its functionalities by keyboard shortcuts:

  • Prt Scrn capture full screen
  • Alt + Prt Scrn capture active opening window
  • Shift + Prt Scrn select capture area by mouse

By default, after capturing screen a dialog will open to ask you what to do with captured image, save or copy it. You can use the Ctrl key combined with these keyboard shorcuts to auto copy it to clipboard.

If the default app is not enough for you, you can try following applications:

  • shutter: best screenshot tool for Ubuntu, it provide many additional features such as upload image, built-in edit tool, hightlight,... You can install it in Softwate Center
  • peek is a tool for recored screen to a gif image
  • Other tools like gyazo, imgur-screenshot or gnome-shell-imgur help you auto upload image to Internet and copy link for you to share with others.
  • Screen recorder tools:

2. Messages filtering with Thunderbird

Messages filter can be done in some mail servers such as Gmail. However, if you use custom mail server and it doesn't support for filtering messages, you can do it with Thunderbird mail client. It helps you organize messages better and avoid lacking important mail.

The feature is so easy to use, you just open Message Filters menu and define the rules to filter emails. You may need to create a folder for filtered emails before defining the rules.

For example: the following rule I defined to move emails from Chatwork to Chatwork folder automatically.

df868a21f3db113027ebb3bbaf8b6b46b86f713f.png

3. Google translate in GoldenDict

GoldenDict is an awesome dictionary application. It supports many language, many type of dictionary, such as dictionary file, from website or from other applications. However, most of dictionaries are only support translate single word.

In this article, I will show you a way to get translation from Google translate by writing custom program that work with GoldenDict.

  • Step 1. Add an external program as dictionary in GoldenDict

    Open GoldenDict, then go to menu Edit -> Dictionaries và and add new programm as follow:

    Screenshot from 2016-11-24 17-21-04.png

  • Step 2. Writing translation program: program receives input original text from Goldendict and output translated text.

    • The program using Google translate API: http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&ie=UTF-8&oe=UTF-8&q=Xin chào

      • sl: source language, auto or language code
      • tl: target language code
      • q: text to be translated, can input in the above url or input via form data (HTTP POST)
    • Response format

      [[["Hello","Xin chào",,,1]],,"vi",,,,0.67846733,,[["vi"],,[0.67846733],["vi"]]]
      

      Or

      [
          [
              ["We updated the voice blog \"Monsters at 3 o'clock AM\".\n\n","ボイスブログ「午前三時の独壇場」を更新しました。\n\n",,,3],
              ["This week is the 100th entrance","今週は第参百弐拾参場",,,3]
          ],,"ja",,,,0.96649998,,[["ja"],,[0.96649998],["ja"]]
      ]
      
    • Write program that call the service api and parse the response

      There is a example program that written in Bash script here. However, it strip all new lines, and I feel not happy, so I rewrite it in PHP (and of course you need install PHP or write your own program 😄)

      <?php
      $text = $argv[1];
      $postdata = http_build_query([
          'q' => $text,
      ]);
      
      $opts = [
          'http' => [
              'method' => 'POST',
              'header' => 'Content-type: application/x-www-form-urlencoded',
              'content' => $postdata,
          ],
      ];
      
      $context = stream_context_create($opts);
      $url = 'http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=en&dt=t&ie=UTF-8&oe=UTF-8';
      $resultText = file_get_contents($url, false, $context);
      $resultText = preg_replace('/,+/', ',', $resultText);
      
      $results = json_decode($resultText);
      if (is_array($results) && count($results) > 0) {
          foreach ($results[0] as $result) {
              echo nl2br($result[0]);
          }
      }
      echo "<hr><a href='https://translate.google.com/#auto/en/$text'>Open in Google Translate</a>";
      

4. SQL client

In addition to tools like phpMyAdmin or MySQL Workbench, you may know some applications like:

  • Adminer: like phpMyAdmin, Adminer is a web application, however, it is more lightweight, and easier to use than phpMyAdmin and support many database types (MySQL, PostgreSQL, SQLite, MS SQL, Oracle,...).

    Screenshot from 2016-11-24 18-16-55.png

  • dbeaver: is an open source application based on Eclipse IDE. It support many database types and has a lot of advanced features like generate code, ER diagram, import/export data, compare database...

    Screenshot from 2016-11-24 18-18-40.png

  • valentina-studio: it is not open, but it's free to use and has a great ui.

5. Oh-My-ZSH

Zsh is cooler than your shell (except your shell is Zsh). It is like Bash (the default shell of Ubuntu) you are using every day in Terminal, but it has more awesome features that help you interact with Terminal fast. Install Zsh: sudo apt install zsh

Oh My Zsh

Oh My Zsh is a framework for managing Zsh configuration, it also includes many plugins (php, rails, git, capistrano, laravel, docker, composer, web-search...) and many pre-configured themes. Visit Github page to learn more and install it.

Additional, you can use Terminator, like default Ubuntu Terminal, but it can split screen to multiple terminal rather than open new tabs, that help you easier to see processes of multiple commands.

6. Other Tools

  • Ubuntu Make: is a command line tool which allows you to download and install lastest IDE, Web framework, programming language tools,... with all dependencies and configuration automatically.

    For example, you can install following tools with one commands: Android Studio, SDK, NDK, PHPStorm, PyCharm, Rubymine, Atom, Eclipse, Go lang, Dart Lang, NodeJs, Unity3d, Kotlin, Scala, Swift,... and many more.

    • Install (Ubuntu > 16.04): sudo apt install ubuntu-make

    • Other Ubuntu version:

       sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
       sudo apt-get update
       sudo apt-get install ubuntu-make
      
    • Using: umake --help to see supported tools, frameworks

  • Markdown editor

  • Clipboard manager: imagine you copy text-1, paste it, then copy another text-2, paste it... Then you want to paste text-1, you can re-open file and copy it, but it is boring. Clipboard tools come to help you

    • Diodon: simple app that display in Ubuntu top bar (indicator)

      sudo add-apt-repository ppa:diodon-team/stable
      sudo apt-get update
      sudo apt-get install diodon
      
    • CopyQ: download .deb file from here and explore it

  • ngrok: is a tool that helps you publish your localhost on local webserver to the Internet.

    It helps you to demo your website quickly to client without deploy it to other web host, test your web in mobile when you cannot access local network,...

    Start using it by download it from here

    Example usage:

    • Publish local web server is runnig at port 80: ngrok http 80
    • Publish local virtual host at address site.dev: ngrok http -host-header=rewrite site.dev 80

    You can see all requests to your web at http://localhost:4040/

  • Test IE

    Because it still exists and many users are still using it, we may need support for it. You can use virtual machines provided by MS here, use it with Virtual Box.

  • Auto check code style

    • Editor config: in a team, developers may using different Code Editors, IDEs. Editor Config help to keep the same configuration includes code styles across all IDEs, Editors.

      Example config:

      root = true
      
      [*]
      indent_style = space
      end_of_line = lf
      charset = utf-8
      trim_trailing_whitespace = true
      insert_final_newline = true
      
      # 4 spaces for indentation in HTML, JavaScript files
      [*.{html,js}]
      indent_size = 4
      
      # 2 spaces for indentation in Markdown files
      [*.md]
      indent_size = 2
      
    • Checking code style before saving file

      If you use Sublime text, you can use plugins like sublime-phpcs to check code php following PEAR, PSR-1, PSR-2 or custom standard, and sublime_rubocop to check ruby code.

Conclusion: If you have other awesome tools, please share. Thank you for reading!


All rights reserved

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí