RSS feed
  • python gtk close on escape key

    Posted on February 17th, 2009 1 comment

    I wanted a gtk window to close when the escape key is pressed:

     
    import pygtk
    pygtk.require('2.0')
    import gtk
     
    class CloseOnEscape :
    	def keypress(self, widget, event) :
    		if event.keyval == gtk.keysyms.Escape :
    			gtk.main_quit()
     
    	def __init__(self):
    		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
    		self.window.connect("key-press-event", self.keypress)
    		self.window.show()
     
    	def main(self):
    		gtk.main()
     
    if __name__ == "__main__":
    	app = CloseOnEscape()
    	app.main()
     
  • Doing what you Love

    Posted on February 9th, 2009 No comments

    Feeling down about doing what you love?

    watch this

  • JQuery + Greasemonkey

    Posted on February 8th, 2009 No comments

    Had to look around to figure out how to include jquery in greasemonkey. Should have just guessed this first; Just use the @require, and your standard jquery document ready code. Heres my template anyway.

     
    // ==UserScript==
    // @name           JQuery Template
    // @author         Zach Dwiel
    // @description    Provide a basic template for using jquery in greasemonkey
    // @include        *://*
    // @require        http://code.jquery.com/jquery-latest.js
    // ==/UserScript==
     
    $(document).ready( function() {
        // your jquery code here
    }
     
  • Emergence

    Posted on February 4th, 2009 1 comment

    simple rules that ants follow create emergant behavior which is the ant colony

    simple rules that people follow create emergant behavior which is the society and culture

    simple rules that the universe follows creates emergant behavior which is ???

  • Controlling Samples by Spitting Them

    Posted on December 24th, 2008 No comments

    Last night, Nate and I were able to sucessfully and intuitively control up to 3 or 4 individual drums based on different sounds vocalized into a mic. The bass drum would play when 'oooh' was sung, a snare when 'eee' was sung and a cymbal when 'aaah' was sung.  There are still some kinks in the system, but as a proof of concept, it works fairly well.  The mapping between input sound and MIDI event are learned in real time so you are not restricted to different vowel sounds.  The 3 distinguishing sounds could have just as easily been a clap, growl and whistle.  The code: fftknn.

  • Growing Couscous

    Posted on December 17th, 2008 2 comments

    edit: no wonder! Couscous is not grown. Couscous is made of wheat, and traditionally rolled by hand for days before being sub dried for months. doh

    It is more common for the word growing when nearby the word couscous to refer to how much in popularity it is changing than the process by which it forms.  At least in the top 10 hits.

  • Net Neutrality

    Posted on December 15th, 2008 No comments

    Net Neutrality is not just about innovation, free speech and democracy, it is about keeping the newly forming synapses of our collective mind free from corruptible power structures.

    god damn this is important.

  • Passwordless login for SSH not working

    Posted on December 8th, 2008 No comments

    I have not been able to login to my system with passwordless SSH for some time now and finally figured out the problem.  I had to change the permissions of my home directory to disallow writing by everyone.  I knew that ~/.ssh and the files in it required specific permissions to be set, but I hadn't heard about the home directory having similar requirements.

  • Oyster Mushrooms

    Posted on November 24th, 2008 1 comment

    So I've been reading a book by Paul Stamets who has given one of the best TED talks I've ever seen, and I watched a lot of them.  The book is fantasy meets scifi meets reality; I'm really enjoying it.  I'm currently reading one of the chapters covering medicinal uses of mushrooms and am really amazed.  One small study of 30 people found that oyster mushrooms could reduce LDL (bad) cholesterol by 30%.  There are 37 results for 'pleurotus ostreatus cholesterol' on pubmed (sorry they don't allow linking to searches).  Many are on animals like rats and rabbits which seem to support the study sited by the book.  It seems to be a fairly well researched phenomenon.

    This begs the question: Is there a reason why doctors do not prescribe oyster mushrooms?  Is there a reason why they don't at least suggest them?  You can even find them freeze-dried, powered and capsulized so you can get the placebo effect of eating pills if thats what you need.  All of the information I was able to dig up as a layman was supportive of the idea that they helped lower LDL cholesterol.

    So I talked to a friend of mine Elizabeth who knows a bit more about the medical industry than I do (she's recieved grant money to do medical imaging research on mice).  Her basic response was that no pharmeseutical corperation is going to fund this kind of research.  Mostly since they couldn't patent a mushroom as common as the oyster which doesn't even need extracting or processing to become medically useful.  I was hoping for a less synical response, but alas, it was the best one I could find.  Anyone else have any ideas about this?

    My next thought (a fairly predictable one if you know me at all) is how we could get around this limitation through distributed cooperation rather than concentrated power and money.  What kind of experiments could we perform by having thousands of people assist from home with.  Could they try eating oyster mushrooms and looking for a change in cholesterol level?  What kind of procedures in a lab would be hard to reproduce and which would be easier?  I understand that this kind of experiment or data mining, wouldn't be of the same rigorous type as one performed by scientists in a lab, but could we not still learn a great deal about it?  How would a system which allowed for these kinds of experiments operate?  Does this already exist?

    Food, Us
  • Script to center the current window (linux)

    Posted on November 7th, 2008 No comments

    Just remembered that I hadn't published this script that I use fairly often which centers the currently active window on the screen using wmctrl (requires the patch provided)

    wmctrl-patch

    center_active_window.py