Posts Tagged “Linux

Simple Python Sendmail Script

Recently I found the need to have sendmail on one of my servers to send me email notifications, but didn’t want to have sendmail actually installed. So some python and smtplib made for an easy, ‘sendmail compliant’ alternative that I could use with services that interface with sendmail for email notifications. The python script is as follows:

#!/usr/bin/env python2
 
import sys, smtplib
 
SERVER = "smtp.gmail.com"
PORT = 465
USER = "email_address_or_username"
PASS = "email_password_here"
ADMINS = ("list_of_recipients@domain.com",)
 
if __name__ == "__main__":
        message_text = ""
        for line in sys.stdin.readlines():
                message_text += line
 
        server = smtplib.SMTP_SSL(SERVER, PORT)
        server.set_debuglevel(0)
        server.login(USER, PASS)
        server.sendmail(USER, ADMINS, message_text)
        server.quit()

(more…)

Filed under:
Tags: , , , ,

Statically Linking Qt Applications on Linux

This article constitutes the second part of Building Qt for Static Linking which demonstrates how to actually compile your Qt application statically against the Qt libraries. This part will be relatively straight forward considering that the hard part of configuring Qt for your needs is already done.

When using self-built versions of the Qt libraries you will need to rerun qmake against your project in order for it to create a Makefile which uses your newly generated Qt library. Assuming you are using the default install path, the following set of commands will rebuild your Qt application using your new library.

(more…)

Filed under:
Tags: , , ,

Building Qt for Static Linking on Linux

It is sometimes helpful when writing applications at all, let alone Qt applications, to statically link against the libraries your application depends on. By default Qt only provides a dynamic library, either an SO or a DLL, and thus you must recompile a version of Qt which generates a statically linkable library (usually a .a file). The following instructions show you how to accomplish this on a Linux system, however, a similar process applies for other operating systems including Windows.

The very first thing you must do before doing anything is to obtain the Qt source code. You will want to go to the Qt downloads page and head down to the Qt libraries section. Above the list of available downloads is a small section which mentions the source code packages. Download one and extract the entire tar ball onto your machine. Here is a link to the latest version of the Qt libraries as of this writing. I will assume that if you are reading this guide you know how to extract a tarball and move into the extracted directory via the command line.

(more…)

Filed under:
Tags: , , , ,

Configuring the PlayStation 3 Controller on Linux

16-12-2008 Alec Hussey 2 Comments

A couple of months ago I stumbled upon a slew of information related to using the PS3 controller as a joystick on Linux. I immediately took my PS3 controller and started experimenting with the documentation out there for doing this sort of thing. Unfortunately however, not everything mentioned in this documentation worked correctly. For instance, I was not able to use a joystick on the controller to control the mouse without a separate piece of middleware. This was because the application I used (the only decent one I was able to find) to signal key presses for every button press on the controller, is unmaintained and had a blocker bug with mouse emulation.

You will need two components in order to make this work: the first being QJoyPad to bind controller buttons to keys, and JoyMouse to use one of the joysticks on the controller to control the mouse. Also remember that I am only using the USB cable to use the controller rather than using it via Bluetooth. I will post directions for using Bluetooth and the accelerometers in the controller at a later date, if I am able to get a hold of a Bluetooth adapter. Nevertheless, the tools are the same.

(more…)

Filed under:
Tags: , , , ,

SETI@Home Optimizers on Linux

As I am a big proponent of the SETI@Home project as well as a Linux user, discovering that optimized SETI applications existed and how to use them was important. It took quite some time to figure this all out by myself since there are hardly any (from what I could find) resources on SETI@Home optimized clients on Linux. Eventually I ran into this site which offers SSE3 and SSSE3 optimized clients for Linux in addition to SSE, SSE2, and SSE3 clients for FreeBSD.

For those of you who don’t know what SETI@Home optimizers are, they are essentially specialized versions of the standard version of the SETI@Home client which take advantage of extended floating-point instruction sets available to certain x86 (Intel, AMD, or the like) processors. Using these instruction sets allows optimized clients to complete work many times faster than it could before with the standard client. For example, prior to using an SSSE3 optimized client on my Intel Core 2 Quad Q6600 my recent average credit (RAC) on SETI was in the 500 range including one other active machine and now my RAC has spiked over 2,500 not including the other active machine.

(more…)

Filed under:
Tags: , , , , ,