Jūs esate

Informacinės technologijos

How to set default username for SSH hosts

One day I got tired of entering

ssh mycoolusername@my.awesome.server.com

Because my username is the same on all the servers. So, what I did - I've created a file and added a default username for the servers:

$ cat ~/.ssh/config
CanonicalizeHostname yes
Host *.my.awesome.server.com
    User mycoolusername

So, I can now connect to is.it.really.my.awesome.server.com by using:

ssh is.it.really.my.awesome.server.com

Java 9 features

Java 9 has introduced a couple of nice features. Let's try to use them? :)
1) Factory Methods for Immutable List, Set, Map and Map.Entry
You can easily create an immutable List, Set or Map by using a .of() method like this:

List<String> newList = List.of("a", "b", "c");
Set<String> newSet = Set.of("a", "b", "c");
Map<Integer, String> newMap = Map.of(1, "first", 2, "second", 3, "third");

Very convenient, I must say. On previous versions of Java you had to make a loop or use some other library to achieve the same result.

How to install Java 9?

Today I started playing with Java 9 on my Ubuntu 17.04. So, I thought it might be handy for other to know how to install Java 9 on Ubuntu. Here are the steps:

How to mount PiDrive on your Raspberry pi?

So, you bought a PiDrive from WD Labs and you want to mount it to yours Raspberry Pi? So, this tutorial might help. Note: I'm using my Raspberry Pi 3 and ordered PiDrive from NextCloud Box. And I will be using entire PiDrive as a one giant partition instead of partitioning it into several partitions.

Follow these steps:

How to delete a tag in GIT?

You create a tag in GIT, accidentally pushed it into remote repository. But after some time you understood that you don't want it. So, how can you remove a tag in GIT?

You can do this easily by:
git push origin :refs/tags/NAME_OF_YOUR_BAD_TAG

The first command deletes this tag from your local repository, the second - from remote repository.

How to select several lines before search line in Linux?

Sometimes you need to look for something (i.e. grep) in file, but you want to see several lines BEFORE and AFTER the line you're looking for. So, how can you do this in Linux?

grep -B 3 -A 3 "Deploying" catalina.out

It looks for text "Deploying" in file catalina.out and returns 3 lines before (-B switch) and after (-A switch) the line with text "Deploying".

35% discount on Oracle certification exams!

Today during my casual trip to work by bus I found one very interesting page - Oracle Certification . It says that:

* Bonus Special Offer
Terms and Conditions

This offer is valid until 12/31/2016.

How to stream video from PC to Smart TV?

There are a couple of options of how to stream video from your PC to your Smart TV. For instance, you can use VLC.

A start job is running for dev-disk - Ubuntu Linux 15.04

Today I had a very akward problem with my Ubuntu Linux 15.04. During boot I got a message saying:

A start job is running for dev-disk

And a timer. As a result, the boot of Linux was delayed for about 1 min 30 s. So, what did I do about it?

I opened sudo vim /etc/fstab and found that the SWAP partition was described as:

Do you want to have Google in every new Firefox tab?

Today I wanted that each of Firefox tab I open had a Google page in it. So, when I click Ctrl + T in Firefox - new tab opens with Google. How can we do it?

  • Open new tab in Firefox.
  • Enter: about:config in URL Address Bar.
  • Click on "I'll be careful, I promise!".
  • Search for browser.newtab.url.
  • Change a value of it to anything you want. I picked: https://www.google.lt/?gws_rd=ssl

You're done! :) You have Google in every new tab of Firefox.


Subscribe to Informacinės technologijos