Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Render web page using PyQt

Answer:

Qt bindings to WebKit have been added since 4.4, so you can use PyQt to script the browser (Webkit based).

Firstly, make sure you have installed the need packages:

# sudo apt-get install libqt4-core libqt4-webkit python-qt4

Then you can write a simple script to test, e.g.

#!/usr/bin/env python

import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

app = QApplication(sys.argv)

web = QWebView()
web.load(QUrl("http://www.google.com"))
web.show()

sys.exit(app.exec_())

Create a short URL from command

Answer:

TinyUrl has a simple api for creating short URL for any web site.

E.g. Assume http://example.com

#  curl 'http://tinyurl.com/api-create.php?url=http://example.com/'

http://tinyurl.com/kotu

Show the Domain Name Servers for a domain

Answer:

To show the Domain Name Servers for a domain, use the command below:

E.g. example.com

# nslookup -type=ns example.com
Server:         203.98.160.11
Address:        203.98.160.11#53

Non-authoritative answer:
example.com     nameserver = b.iana-servers.net.
example.com     nameserver = a.iana-servers.net.

Authoritative answers can be found from:
a.iana-servers.net      internet address = 192.0.34.43
b.iana-servers.net      internet address = 193.0.0.236
b.iana-servers.net      has AAAA address 2001:610:240:2::c100:ec

Enable compression during scp transfer

Answer:

When you transfer files which are mainly text based using scp command, it is always good to compress them to save the bandwidth needed.

To do so:

# scp -C test.txt john@remoteserver:/home/john/

What is the SMTP submission port 587?

Answer:

A lot of ISPs will block the port 25 for preventing users from sending spam emails. To send email if you use such ISPs, you need to use port 587.

Port 587 is the official port for sending email on mail submission agents (MSAs), as defined in RFC 2476