Popular recipes by Anton Vredegoor http://code.activestate.com/recipes/users/2667360/2015-11-18T14:02:19-08:00ActiveState Code Recipessimplify webpage (Python) 2015-11-18T14:02:19-08:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/579107-simplify-webpage/ <p style="color: grey"> Python recipe 579107 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/adblocking/">adblocking</a>, <a href="/recipes/tags/drag_and_drop/">drag_and_drop</a>, <a href="/recipes/tags/html2text/">html2text</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/tor/">tor</a>). Revision 4. </p> <p>drag and drop urls from your browser's navigation window to a tkinter widget</p> bookmarks browser for firefox (Python) 2015-07-06T23:15:31-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/579077-bookmarks-browser-for-firefox/ <p style="color: grey"> Python recipe 579077 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/bookmarks/">bookmarks</a>, <a href="/recipes/tags/firefox/">firefox</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). </p> <p>a small tkinter gui to browse the .json type bookmark files firefox automatically generates each day. It's meant to be run from a terminal. If a tree item is doubleclicked it prints the uri.</p> Tail multiple pidgin IRC logfiles (Python) 2015-06-06T12:13:00-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/579066-tail-multiple-pidgin-irc-logfiles/ <p style="color: grey"> Python recipe 579066 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/colorize/">colorize</a>, <a href="/recipes/tags/irc/">irc</a>, <a href="/recipes/tags/iterators/">iterators</a>, <a href="/recipes/tags/logfiles/">logfiles</a>, <a href="/recipes/tags/merging/">merging</a>, <a href="/recipes/tags/nonblocking/">nonblocking</a>, <a href="/recipes/tags/pidgin/">pidgin</a>, <a href="/recipes/tags/tail/">tail</a>, <a href="/recipes/tags/threads/">threads</a>). Revision 2. </p> <p>Tail multiple pidgin IRC logfiles. </p> <p>Pidgin should be connected to IRC with the channels one wants to tail joined, and it should save logs as text.</p> <p>The script needs two arguments:</p> <pre class="prettyprint"><code>the directory containing the directories with channel logs a list of channel names, quoted and separated by spaces </code></pre> <p>Example command:</p> <p>python pidgin-irctail.py -d <a href="mailto:~/.purple/logs/irc/YOUR_IRC_HANDLE@irc.freenode.net">~/.purple/logs/irc/YOUR_IRC_HANDLE@irc.freenode.net</a> -c "#chan1 #chan2 #chan3"</p> <p>Some text elements are higlighted, and channel names are inserted into the log lines after the time info.</p> <p>If more than one channel is entered, the output of the logs is merged. </p> How to stream an mp3 file using vlc.py, with a simple TKinter GUI. (Python) 2013-06-09T12:52:30-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/578556-how-to-stream-an-mp3-file-using-vlcpy-with-a-simpl/ <p style="color: grey"> Python recipe 578556 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/streaming/">streaming</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/vlc/">vlc</a>). </p> <p>This script can be used to stream an existing mp3 file to multiple computers. It has a simple Tkinter GUI with only one button to start/stop the stream, and a slider to indicate or change the position.</p> Using vlc.py to record an mp3 and save a cue file (Python) 2011-07-25T15:55:38-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/577802-using-vlcpy-to-record-an-mp3-and-save-a-cue-file/ <p style="color: grey"> Python recipe 577802 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/recording/">recording</a>). Revision 2. </p> <p>This is an example of how to use vlc.py . It records an mp3 file from an online audio stream, using the track announcements to write an accompanying cue file. </p> Terminal directory changer (GUI) (Python) 2010-10-21T18:58:04-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/577435-terminal-directory-changer-gui/ <p style="color: grey"> Python recipe 577435 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/cd/">cd</a>, <a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/python_scripts/">python_scripts</a>, <a href="/recipes/tags/terminal/">terminal</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 2. </p> <p>Start this script from a terminal to change the terminal itself to a new directory, using a graphical tree view.</p> Generate the partitions of a set, by index (Python) 2010-04-30T11:07:30-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/577211-generate-the-partitions-of-a-set-by-index/ <p style="color: grey"> Python recipe 577211 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/combinatorics/">combinatorics</a>, <a href="/recipes/tags/partition/">partition</a>). </p> <p>Sets of only a few items already have many ways they can be partitioned into subsets. Therefore it can be useful to generate these partitions by index, like the partition class were some large list where one can just access element "i". Of course one should not compute the whole list in advance but compute the partitions on the fly. This recipe was originally extracted form a book by Kreher and Stinson. Over the years I came back to my code from time to time creating a new and hopefully more pythonic version each time I understood it better. My current take on it is that the algorithm looks a lot like creating a Pascals triangle in order to compute combinations. One just tries to find a way down the triangle to a specific element, each time subtracting the amounts the different positions in the triangle account for. It is also similar to finding indexed permutations of a set with elements occurring more than once. One of these days I will perhaps understand how all of this fits together. Until then I'll post code solving specific situations. </p> analog clock (Python) 2009-07-04T03:03:22-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/576830-analog-clock/ <p style="color: grey"> Python recipe 576830 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/clock/">clock</a>). </p> <p>A very simple tkinter analog clock</p> Generate the permutations of a bag (Python) 2006-05-20T02:15:17-07:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/496724-generate-the-permutations-of-a-bag/ <p style="color: grey"> Python recipe 496724 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 4. </p> <p>While I have seen many permutation recipes on this site, there seems to be no recipe yet which shows how to generate the permutations of a "bag". A bag is like a set but can contain elements more than once.</p> Sudoku Solver using a 3D-metaphor (Python) 2006-02-24T11:01:32-08:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/474076-sudoku-solver-using-a-3d-metaphor/ <p style="color: grey"> Python recipe 474076 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> . Revision 3. </p> <p>This script views a sudoku problem as a 3-dimensional binary cube. It solves the sudoku problem by wiping away x,y,z points from this cube until the solution appears.</p> Sets using a sorted list of integers representing the items (Python) 2005-11-22T15:43:11-08:00Anton Vredegoorhttp://code.activestate.com/recipes/users/2667360/http://code.activestate.com/recipes/452502-sets-using-a-sorted-list-of-integers-representing-/ <p style="color: grey"> Python recipe 452502 by <a href="/recipes/users/2667360/">Anton Vredegoor</a> (<a href="/recipes/tags/algorithms/">algorithms</a>). Revision 2. </p> <p>This is inspired by Raymond Hettingers recipe for sets, using sorted lists. However here I'm not sorting the original list but just the indices and the sets share a common universe. This code is not for production use, I just show it in order to explain what I want to do.</p>