Routing to allow SSH over a specific interface

Sometime when you have two network interfaces (say eth0 and eth1) on the client and for some reason there is a need to SSH to the server over a specific a specific interface. By default the primary interface will be used. To use eth1 we just need to add a route:

route add -net 10.75.0.0 netmask 255.255.255.0 gw 192.168.0.1 eth1

The route is removed upon reboot. Use -p to permanently add the route to the table. To delete the route:

route del -net 10.75.0.0 netmask 255.255.255.0 gw 192.168.0.1 eth1

 

Simplify Your Life With an SSH Config File

If you’re anything like me, you probably log in and out of a half dozen remote servers (or these days, local virtual machines) on a daily basis. And if you’re even more like me, you have trouble remembering all of the various usernames, remote addresses and command line options for things like specifying a non-standard connection port or forwarding local ports to the remote machine.

Continue reading

How To Enable HTTP/2 in Apache on Ubuntu 16.04

Here’s a simple guide showing how you can enable HTTP/2 in Apache on Ubuntu 16.04.

Today’s internet connections are amazingly fast. You younglings might not believe this, but there was a time when we actually had to sit and wait for a website to appear. If you want to experience the internet speeds of the past, give 56k Emulator a try. It will give you the basic idea. And keep in mind that 56K modems were freakin’ fast when they became available.

Even though today’s internet connections are fast, the technology used to push propaganda around inside the tubes is old and slow. HTTP/1.1 was never intended to be used with the kind of content-heavy website we have today. Thankfully, there’s a new option available, the marvelous RFC-7540. Or HTTP/2, if you will.

Continue reading

Stream Torrents with VLC on Linux/Mac Without Any App

When Popcorn Time was released, it quickly got popular because of its functionality of playing video files from torrents either in its on video player or in VLC Media Player or on TV through Chromecast. Currently, there are two versions of Popcorn Time on the web. The original Popcorn Time apart from streaming movies, also lets you play videos using Torrent links or Magnet links. This is one nice feature if you want to watch a video or movie that’s not in the app’s directory of movies or shows.

Continue reading

What’s the difference between .tar.gz and .gz?

In Unix and Unix-like systems (like Ubuntu), archiving and compression are separate.

tar puts multiple files into a single (tar) file.

gzip compresses one file (only).

So to get a compressed archive, you combine the two, first use tar or pax to get all files into a single file (archive.tar), then gzip it (archive.tar.gz). If you only have one file you need to compress (notes.txt), there’s no need for tar, so you just do gzip notes.txt which will result in notes.txt.gz. There are other types of compression, such as compress, bzip2 and xz which work in the same manner as gzip (apart from using different types of compression of course)

Source: http://askubuntu.com/questions/122141/whats-the-difference-between-tar-gz-and-gz-or-tar-7z-and-7z

L2TP / IPSEC VPN on Ubuntu 16.04

LT2P IPSEC vpn works simple and easily with iOS/Android and Windows 10. Unfortunately as many people likely know (after a few google searches it seems) the client for this is pretty crap in Ubuntu 16.04.

Our setup uses a shared PSK, and a username and password.

I’ve tried a bunch of the quick setup guides, but many were for older versions of Ubuntu and thus didn’t work very well. Finally I stumbled across this guide: https://gist.github.com/psanford/42c550a1a6ad3cb70b13e4aaa94ddb1c

which was used to connect with a meraki router over vpn. There were some minor tweaks in my case, but I managed to get it work.

Continue reading

vim – perform a global search and replace

To perform a global search and replace in vim, use the search and replace command in command mode:

:%s/search_string/replacement_string/g

The % is a shortcut that tells vi to search all lines of the file for search_string and change it to replacement_string. The global (g) flag at the end of the command tells vi to continue searching for other occurrences of search_string. To confirm each replacement, add the confirm (c) flag after the global flag.

Setting the NLS_LANG Environment Variable for Oracle Databases

Setting the NLS_LANG Environment Variable for Oracle Databases:

  • On Window
    set NLS_LANG=AMERICAN_AMERICA.UTF8
  • On Unix (Solaris and Linux, CentOS, Ubuntu etc.)
    export NLS_LANG=AMERICAN_AMERICA.UTF8

It would also be advisable to set env variable in your .bash_profile [on start up script]

This is the place where other ORACLE env variables (ORACLE_SID, ORACLE_HOME) are usually set.

How to Compress and Extract Files Using the tar Command on Linux

Compress an Entire Directory or a Single File

Use the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directory inside a directory you specify–in other words, it works recursively.

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Here’s what those switches actually mean:

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
  • -f: Allows you to specify the filename of the archive.

Continue reading