The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘*nix’ Category

Downloading https urls from the commandline through cURL for Windows

Posted by jpluimers on 2014/01/27

Lately I moved more and more away from wget, mainly because out of the box, wget (and also aria2, which I like for the bittorrent support) handle https downloads so badly: you need to manually setup your CA store on each and every installed system.

Not so with cURL, especially not on Windows any more, as “recently” (that is: since the last time I examined it, which is over a year ago now), there is a new kid in town: cURL for Windows: a Windows Installer for the Web Transfer Tool.

You don’t even need to download the installer. Grabbing the stuff from the bin directory in the zip download is enough: it contains a prepackaged CA certificate set that works splendid.

So now downloading https://dl.google.com/update2/installers/ChromeStandaloneSetup.exe to the current directory is as simple as Read the rest of this entry »

Posted in *nix, Batch-Files, Development, Power User, Scripting, Software Development, wget, Windows | Tagged: , | Leave a Comment »

openSUSE 12.x: today the same system would not plain “reboot” either (was: “A plain `halt` will not shutdown)

Posted by jpluimers on 2014/01/26

A long time ago I wrote about openSUSE 12.x: “A plain halt will not shutdown the system properly.” « The Wiert Corner – irregular stream of stuff.

Well, today, for the very first time, a plain “reboot” didn’t work on this system either showing the same symptom as the “halt”: it would shutdown all services, but not perform an ACPI power cycle.

Luckily the system is still on ESXi, so I could reboot using the ESXi vSphere client.

–jeroen

Posted in *nix, Linux, openSuSE, Power User, SuSE Linux | 1 Comment »

Sendmail: Redirecting domain based mail to multiple addresses: virtusertable and aliases file

Posted by jpluimers on 2014/01/26

When doing virtual sendmail hosting, in the domain based virtusertable file, you setup a domain based alias to point to a local alias:

foo.and.bar@example.org    foo.and.bar

In the local aliases file, you setup a local alias to redirect to multiple addresses (or other aliases redirecting features):

foo.and.bar: foo@example.org, bar@example.org

–jeroen

Posted in *nix, Linux, Power User, SuSE Linux | Leave a Comment »

When yast2 in another session didn’t fully terminate…

Posted by jpluimers on 2014/01/26

Sometimes you get this when starting yast2:

System management is locked by the application with pid #### (@@@@@@).
Close this application before trying again.

This means another yast2 process with pid #### and name @@@@@@ is active, or hasn’t shut down properly.

@@@@@@ usually equals /usr/lib/YaST2/bin/y2base or /usr/sbin/packagekitd.

First, view what the process is about by issusing this ps command that shows you a bit more context around the single pid ####: Read the rest of this entry »

Posted in *nix, Linux, Power User, SuSE Linux | Leave a Comment »

terminal emulator – What is making my cursor ‘randomly’ disappear? (via: Unix & Linux Stack Exchange)

Posted by jpluimers on 2014/01/26

Annoying issue when suddenly the cursor on your OpenSUSE terminal session is gone, but the fix is simple run <a href="http://linux.about.com/library/cmd/blcmdl1_reset.htm" target="_blank" rel="noopener">reset</a>:

it’s possible that your TTY has been mangled by some other program you’ve run. Try running reset and then clear (or ctrl-L) to initialize your terminal.

–jeroen

via: terminal emulator – What is making my cursor ‘randomly’ disappear when using gnome-teminal? – Unix & Linux Stack Exchange.

Posted in *nix, Linux, openSuSE, Power User, SuSE Linux | Tagged: , , | Leave a Comment »

How to Keep Alive SSH Sessions (getting rid of the “Write failed: Broken pipe”)

Posted by jpluimers on 2014/01/25

Getting rid of the dreaded “Write failed: Broken pipe”.

Note the difference of ServerAliveInterval/ServerAliveCountMax and ClientAliveInterval/ClientAliveCountMax.

For Mac, Linux and CygWin: Read the rest of this entry »

Posted in *nix, Apple, Cygwin, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, SuSE Linux | Leave a Comment »

praliases: the reverse of makemap generates an aliases text file out of aliases.db files

Posted by jpluimers on 2014/01/25

In case you want to inspect any of your aliases.db files, use praliases: the reverse of makemap to get an aliases text file.

Plus you don’t have to remember the makemap options.

Use the -f option to dump a specific db file:

snap:/etc/mail # praliases -f /etc/aliases.db

–jeroen

Posted in *nix, Linux, Power User, SuSE Linux | Leave a Comment »

Generate HTML Tables Clean and Fast

Posted by jpluimers on 2014/01/23

I wish I had found about Generate HTML Tables Clean and Fast years ago.

Every once in a while I want to generate the source code for an HTML table with some content easily.

I’ve found no tool doing this in an easy manner and starts in a split second.

But the web page Generate HTML Tables Clean and Fast does.

Correction: did. It is now off-line, but the Blended Technologies » Blog Archive  blog posts about it are still online: Introducing TableGen – The HTML Table Generator and Tablegen Goes Open Source, as is the WayBack machine archive for it.

So I installed Python on my openSUSE server according to Embedding Python In Apache2 With mod_python (… OpenSUSE) | HowtoForge, (could as well have configured in httpd.conf in stead of python.conf: no difference between installing mod_python via httpd.conf and conf.d in apache) then installed the TableGen source there.

(Note: more python.conf examples)

That would still have Python generate a 404 error (uncool: a python generated 404 error does not leave a log of the cause anywhere), not because the index.py was absent, but because it was written in old style “print” statements, not using the new style def index(req); way (thanks Senthil Kumaran, and AJ. for your answer).

So I did some research (this was my first encounter with Python) at for instance Paul Osman : Introduction to mod_python, then rewrote the print parts of the script into string concatenations, then return the full HTML.

(Note: if there is a print "Content-Type: text/html" (for instance demonstrated in Hello World | Web Python), you can omit it, or set the req.content_type like req.content_type = 'text/html' which usually is determined automatically by Python).

That caused quite a few IndentationError: expected an indented block quote errors: python is indentation sensitive (I hadn’t used a language depending on that for ages), and gives a confusing error when you have a colon (:) followed by an unindented docstringPython: I’m getting an ‘indented block’ error on the last 3 quotes (“””).

Then it still didn’t completely work: the form parameters would not be obtained correctly, so I read further, found 3.1 A Quick Start with the Publisher Handler and started to fix that too. That took way too long, so I found out that “mod_python” is not very much maintained any more and “mod_wsgi” is the way to go.

So I disabled the “python” module in YaST2, removed “/etc/apache2/conf.d/python.conf”, then installed the “apache2-mod_wsgi” software package in YaST2, then added the “wsgi” module to HTTP Server Configuration list of Server Modules (it automatically gets enabled) and saved the configuration.

These steps modified the APACHE_MODULES in /etc/sysconfig/apache2, restarted apache with “rcapache2 restart”. You can verify with “httpd2 -M” which modules are loaded. The list should exclude “python_module (shared)” and includes “wsgi_module (shared)”.

Most of this is described in has anyone gotten mod_wsgi working.

Python is whitespace sensitive, but you can have multiple statements on one line. That’s why Python allows semicolons after each statement.

Read Setting up Python with WSGI on Apache for a directory – Stack Overflow.

Read PyCon Conference Slides – Sydney 2010 – Python WSGI adapter module for Apache.

Read Graham Dumpleton: Why are you using embedded mode of mod_wsgi?.

Read Serving Python scripts with Apache mod_wsgi, part I | Leave No Bit Unturned.

Read Parsing the Request – Get | Web Python.

Watch WSGI Tutorial. It explains a lot, including Accessing POST Data from WSGI.

Error “Attempt to invoke directory as WSGI application” -> you cannot do that, there is no way to map a directory to an “index.py” in that directory.

For importing .py files from the same directory as your main .py file:

    import os
    import sys

    directory = os.path.dirname(__file__)
    sys.path.insert(0, directory)

    from webutils import *

Start using The Web framework for perfectionists with deadlines | Django.

A few really cool things about this page:

  • It is a web page, so easy to reach
  • It starts fast
  • You can increase the column/row count without loosing the entered data
    (as it stores the contents as a URL)
  • It can generate a thead for you
    (but not a tfoot)

Generating something like this was a breeze: Read the rest of this entry »

Posted in *nix, Apache2, Development, HTML, Linux, openSuSE, Power User, Software Development, SuSE Linux, Tumbleweed, Web Development | Leave a Comment »

*nix networking – lsof: How to tell what process has a specific port open on Linux (via: Server Fault)

Posted by jpluimers on 2014/01/10

I usually used netstat with some grep filter for this, but Brandon Titus showed at StackOverflow that the lsof command is much easier to use:

lsof command should be able to do this just fine. Just use this:

lsof -i :<port_number>
lsof -i udp:<port_number>
lsof -i tcp:<port_number>

and all of the processes should come up.

The lsof commands work on SUSE, Max OS X, CygWin and many other environments.

(update 20160304: added more arguments and links)

Two other commands I use often:

netstat -tulpn | sort

(for connected and listening tcp/udp ports it shows processes and port numbers; see the netstat parameters for more details, note that -u includes udp and -l adds listening sockets)

rpcinfo -p ; rpcinfo -s

(shows the ports used by rpcbind)

Note that one day I’ll learn the iproute2 equivalents (many of which have non descriptive 2 letter names like ip, iw, ss, tc, maybe because iproute2), but as OS X still doesn’t have iproute2, I’m hesitating. Anyway, that day:

–jeroen

via

Posted in *nix, Apple, Cygwin, Linux, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.8 Mountain Lion, Power User, SuSE Linux | 1 Comment »

Oops: Sendmail ok on 127.0.0.1 but not ip address

Posted by jpluimers on 2014/01/06

When configuring a fresh SUSE machine, I forgot one tiny detail resulting in Sendmail ok on 127.0.0.1 but not ip address.

Solution:

Please change in /etc/sysconfig/mail from SMTPD_LISTEN_REMOTE="no" to

SMTPD_LISTEN_REMOTE="yes"

then run SuSEconfig

and rcsendmail restart

–jeroen

via: Re: [SLE] Sendmail ok on 127.0.0.1 but not ip address.

Posted in *nix, Linux, openSuSE, Power User, SuSE Linux | Leave a Comment »