Web developer. Unix lover. Server caretaker. Pythonista.

Text

Super hacky but it works. See also: p.cmdline or p.exe if you have a different type of process you’re looking for (i.e. my script uses several params so I’m actually parsing p.cmdline because p.name is merely ‘python’)

   import psutil

   for p in psutil.process_iter():
       if 'foo' in p.name:
           f = open('/var/run/foo.pid','wb')
           f.write(str(p.pid))
           f.close()

Text

Having a nerd night monitoring processes on a newly launched celery codebase, watching the IT crowd and setting up vnc on my home network. ♥

Text

So I know the PyLadies are a hard group to keep track of, with all the hackathons, hacknights, workshops and pylady nights, these women are hard to track down!

So I started a search to hunt the PyLadies… here’s the trail of clues:

  • First, I hopped into the #pyladies IRC channel on freenode. I noticed @sandymahalo was there and I said hi! First, pylady spotted!
  • Then, I pinged @PyLadies on twitter. Within minutes, @audreyr responded. Another pylady spotting!
  • Audrey told me about upcoming Pylady hacknights, which happen every other Monday in locales around the world, loosely organized via IRC #pyladies channel. I heard the PyLadies in Los Angeles were having regular in person meetings and since I live on the west side, I pinged @webdevgirl (xtine on IRC) about where she was organizing the West LA hacknight this coming Monday, July 25. She got right back to me and I met up with her and hacknighted it up!
  • After the hacknight was so successful, I thought I *must* see the photos. @backcode (Sophia) told me all about the PyLadies flickr page! Tagged!
  • I knew there must be more PyLadies lurking around, so I found out that @estherbester and @tiny_mouse (Jess) were organizing events at this year’s Djangocon via the PyLadies website mailing list. Email input — > updates received!
  • @kjam tracked down all of my hunting, so she bugged me to join the PyLadies Volunteer List so I could help out with the daily operations of PyLadies and all the fun events they put together.
  • I decided I liked this whole PyLadies thing, so after hunting them all down, I liked them on Facebook. Commence internet warm fuzzies.

Keep up with us in all of these many ways, or help create more. :)

♥, kjam

New PyLadies Shirts: I <3 PyLadies # supporting women who code

ZOMG AHHHHMAZING!!

Text

Puts parent dir on python path. Useful for me at times… :)


sys.path.append(os.path.dirname(os.getcwd()))

Great success!

(If you need to use the beauty of celerymonitor from a non-web browser. Feel free to usethis script, and then a simple: from celery.events.state import state will give you lots of goodies.

For more info, see: http://github.com/ask/celerymon/blob/master/celerymonitor/handlers/api.py
and: http://ask.github.com/celery/reference/celery.events.state.html

Celery is awesome.

Great success!

(If you need to use the beauty of celerymonitor from a non-web browser. Feel free to use
this script, and then a simple: from celery.events.state import state will give you lots of goodies.

For more info, see: http://github.com/ask/celerymon/blob/master/celerymonitor/handlers/api.py
and: http://ask.github.com/celery/reference/celery.events.state.html

Celery is awesome.

Text

(or How to gain confidence and ability, friends and mentors, and help others along the way)

  1. Everyone was a n00b.

  2. Conversation is a part of coding.

  3. You are awesome.

Xoxo, kjam

New PyLadies Event: Inaugural Hackathon on June 18.. HOLLA!

Text

.. you start referring to your servers by the last 5 digits of the IP.

No, really.

Text

So I have to do a lot of “reports” for ppl at work where I need to quickly build files for them to use from active databases. I wrote this to pass in a million and a half things and quickly output them. The normal python mysqldb cursor returns a tuple, but this can also be used for arrays (but not dicts). Hope it’s helpful for someone!

For usage, pass full filepath file name, an array or tuple of titles for the columns/fields and then the data from mysql itself.

def write_tuple_to_file(file_name,titles,tpl):
    f = csv.writer(open(file_name,'wb'), delimiter=',',quotechar='"')
    f.writerow(titles)
    for x in tpl:
        f.writerow(x)