Archive for the ‘Uncategorized’ Category

GotoMyPC viewer on Linux

Sunday, April 28th, 2013

A little known fact is that GotoMyPC viewer can actually run on Linux.

Prerequisites:

  • Firefox Browser
  • Wine
  • User Agent Switcher for Firefox

Process:

  1. Open Firefox and login to your GotoMyPC account.
  2. Set the user agent to IE6 using Tools->User Agent
  3. Press the connect button for the computer you wish to view
  4. Open the gotomypc-start.exe with Wine(Firefox should give you this as the defailt selection)
  5. You’re done!

Killing child processes of Celery tasks, on a timeout

Wednesday, September 7th, 2011

This is a quick Monkeypatch to make sure that all child processes are killed when a worker is killed.

from celery.worker import state
import celery.worker.job
from celery import exceptions

def kill_child_processes(parent_pid, sig=signal.SIGTERM, top=True):
        ps_command = subprocess.Popen("ps -o pid --ppid %d --noheaders" % parent_pid, shell=True, stdout=subprocess.PIPE)
        ps_output = ps_command.stdout.read()
        retcode = ps_command.wait()
        if retcode != 0: return
        for pid_str in ps_output.split("n")[:-1]:
            try:
                kill_child_processes(int(pid_str), sig, top=False)

                if not top: os.kill(int(pid_str), sig)
            except OSError: pass


def on_timeout(self, soft, timeout):
    """Handler called if the task times out."""
    state.task_ready(self)
    if soft:
        self.logger.warning("Soft time limit (%ss) exceeded for %s[%s]" % (
            timeout, self.task_name, self.task_id))
        exc = exceptions.SoftTimeLimitExceeded(timeout)
    else:
        kill_child_processes(self.worker_pid)
        self.logger.error("Hard time limit (%ss) exceeded for %s[%s]" % (
            timeout, self.task_name, self.task_id))
        exc = exceptions.TimeLimitExceeded(timeout)

    if self._store_errors:
        self.task.backend.mark_as_failure(self.task_id, exc)


celery.worker.job.TaskRequest.on_timeout = on_timeout

How I deployed My django app on IIS 7

Saturday, April 2nd, 2011

So in work(Citrix),

We’ve been working on a django based application to analyse debug data from XenServer..

I was asked to deploy the application internally in such a way that availed of AD Single sign on in our intranet..  This would mean that I’d have to run it on a windows box and avail of Kerberos or NTLM authentication..

This posed a problem for me.. My application depends a lot on some standard Linux commands(grep, busybox etc)

So I decided to keep the application running on a Linux machine, and try to use some protocol to proxy the requests from IIS, which would be doing the authentication.. I would use the REMOTE_USER header to identify the user authenticated.

I tried apache with fastcgi and mod_auth_sspi.. but the authentication was flaky, sometimes worked, sometimes didn’t..

I decided that I needed to use IIS if I was to get stable authentication… But its fastcgi implementation didnt support sending the request to another box.

I was running out of ideas.. then I seen that there was a AJP connector for IIS which comes from the apache tomcat project in the form of isapi_redirect. So I gave it a go..

I used flups ajp implementation on the django side.. everything was going great, I could authenticate using IIS and the request was passwd back to the django box..

Except for one thing.. My application requires a large file upload(~100mb).. and it took hours.. i.e. 20kb/s. I first thought it was IIS.. but no. Flups AJP implementation is very very slow.

I seen that flups author also had a C based project, ajp-wsgi, I tried it out and it was much better very reliable.. there was a small hick-up at the start but allen patched that up.. Thanks..

So in essence, If you need windows authentication, and you need your django app to run on Linux.. use IIS, isapi_redirect, and ajp-wsgi..

Why I got rid of my IPhone…

Saturday, April 2nd, 2011

The IPhone is a great device…

Great operating system…

Readily hackable…

Great app store…

But.. IT DOESN’T HAVE AN FM RADIO

I tried getting my radio via 3G.. but I always forgot to turn it off and my credit would be all gone.

So I decided to get rid of it.. and I got myself a ZTE Blade(Orange san francisco). It’s such a luxury having an FM radio now.. I don’t think i’ll move off android..

ZTE Blade

A message for Steve Jobs: Dont be stupid, i’m not going to buy a 400 euro device and it not have an FM radio.. it will cost you like 5 cent to put an FM radio in the device..

The ZTE blade cost me 99 pounds sterling.. it’s not as good in the IPhone in some respects.. but it has the most important feature I need…

OpenWRT eircom settings

Saturday, January 15th, 2011

Because I’ve been on a OpenWRT buzz, I wanted to use an old D-Link DSL/Router for OpenWRT.

I was ripping my hair out trying to figure out why I couldnt get DSL to sync. It turns out that I was using a variable voltage adaptor and I should have been giving 12V but i was only giving 6V! Anyway once i upped the voltage DSL started to sync.

For anyone else that wants to use OpenWRT with eircom use the following settings in /etc/config/network:


config 'interface' 'loopback'
	option 'ifname' 'lo'
	option 'proto' 'static'
	option 'ipaddr' '127.0.0.1'
	option 'netmask' '255.0.0.0'

config 'interface' 'lan'
	option 'type' 'bridge'
	option 'ifname' 'eth0'
	option 'proto' 'static'
	option 'ipaddr' '192.168.2.1'
	option 'netmask' '255.255.255.0'
	option 'nat' '1'

config 'atm-bridge'
	option 'unit' '0'
	option 'encaps' 'llc'
	option 'vpi' '8'
	option 'vci' '35'
#	option 'payload' 'routed'

config 'interface' 'wan'
	option 'ifname' 'nas0'
	option 'proto' 'pppoe'
	option 'encaps' 'llc'
	option 'vpi' '8'
	option 'vci' '35'
	option 'keepalive' '5,20'
	option 'username' 'eircom@eircom.net'
	option 'password' 'broadband1'

Arch Linux

Friday, December 4th, 2009

So I’ve moved to Arch,
I think this will be the end of my distro hopping, arch can give me everything I need, and with the rolling release it means I never need to upgrade, although I do like to start from scratch every now and again(i keep a very messy home directory).

Check it out. Dont forget to check out the best feature, AUR, similar to opensuse’s build service, but way better.

Beware that the installer is basic, you need to know your way around linux to be able to do anything remotly advanced (raid or LVM).

I’m going to blog more

Thursday, December 3rd, 2009

I haven’t been blogging as much as i’d like to. To change this i’m using this cool blogging client called “charm”
I hope this will make it easier for me to blog more. I have lots of useful stuff to say!

Using an OpenLDAP directory for Thunderbird address book lookups

Friday, March 13th, 2009

I wanted thunderbird to be able to look up addresses in my OpenLDAP directory. It worked out of the box somewhat using the standard inetorgperson attributes. But i wanted to map some of my POSIX attributes so Thunderbird would recognize them and therefore there would be more information in the address book entry.

Here is a table of ldap attributes thunderbird is interested in.

http://www.mozilla.org/projects/thunderbird/specs/ldap.html

This is based on a less than perfect schema that mozilla came up with.

Anyway, Thunderbird already gave me the First name(givenName), lastname(sn), displayname(cn), and email(mail) bits from each address book entry, but i wanted it to fill in the Nickname from the POSIX gecos attribute(It usually contains a little more information than just the name), so this is what had to be done on the OpenLDAP side

my DIT for this example is dc=example,dc=com and my users entries will be in ou=user

First i had to download and install the mozilla LDAP schema  from https://wiki.mozilla.org/MailNews:Mozilla_LDAP_Address_Book_Schema

I had to then define a new “relay” database at the botton of my slapd.conf, it looks something like this:

database                relay
suffix                  “dc=addresses”
relay                   “ou=user,dc=example,dc=com”
overlay                 rwm
rwm-suffixmassage       “ou=user,dc=example,dc=com
map attribute mozillaNickname gecos
map attribute mail *
map attribute uid *
map attribute sn *
map attribute givenname *
map attribute cn *
map attribute *

This will create a second virtual DIT called dc=addresses which will use the “real” ldap directory(ou=user,dc=example,dc=com) as a back-end. This will map the gecos to the mozilla nickname and it will now appear in the users address book entry in thunderbird, it also blocks all information except the bits that are needed like displayname, cn, givenname, sn. It would probably be advisable to apply some ACLs to this aswell just incase.

This is only an example. If you have other attributes that might fit into an address book entry then you can map them to the mozilla atrributes.

LVM progress update cont.

Friday, January 18th, 2008

OK so we’re successfully booted off the new LVM based root filesystem.

Now i want to move everything back onto the dm softraid array. So we delete the old home and root partitions and make them into a new big partition with an LVM label,(I justed yast to do this coz i couldn’t have been arsed looking up the commands.

Now we convert this new big partition into a LVM physical volume:

pvcreate isw_cggibjcgah_Raid_part5

And then add it to the system volume group.

vgextend system isw_cggibjcgah_Raid_part5.

Now we can actually start moving stuff over (on the fly) to the array.

/dev/sda1 is the physical volume we want to release, its currently where root and home is. But this command will move the partitions to any other free physical volumes, which there is only one, the array,  system isw_cggibjcgah_Raid_part5.

pvmove /dev/sda1

But i got an error saying the mirroring module isnt loaded, so we load that:

modprobe dm-mirror

And after this the command will run successfully, It takes a while, depending on the size of your disks.

Now we have a free sda1 physical volume that we can remove out of the volume group.

vgreduce system /dev/sda1

And then make it a non physical volume using

pvremove /dev/sda1.

And that should be it. A successful conversion from standard linux block device to Logical volumes without loosing any data!

Two things to note that may render your system unbootable are these:

  1. Don’t touch your/boot partition/device, grub needs this and cannot read from a logical volume!
  2. Leave your swap space as an ordinary partition too, although the system will attempt to boot even though it cant access any swap space.

BBC iPlayer woes.

Monday, January 14th, 2008

Well I have to hand it to BBC’s IT team, I’ve spent all evening trying to get iPlayer to work where I am in Dublin and I couldn’t manage it. I tried numerous methods like:

  • Numerous proxies on proxy lists around the web
  • VPNing into my work network(I’m amazed this didn’t work)
  • Just going to the website directly(ye this was a dead horse)

One last thing I could do would be to boot my Laptop into windows because the Linux VPN client isn’t the best, but of course that would mean booting into windows.


Copyright © 2018 All Rights Reserved.
No computers were harmed in the 0.401 seconds it took to produce this page.

dmarkey.com