<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://dsss.be/w/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://dsss.be/w/feed.php">
        <title>Tyler&#039;s wiki - python</title>
        <description></description>
        <link>https://dsss.be/w/</link>
        <image rdf:resource="https://dsss.be/w/_media/wiki:dokuwiki.svg" />
       <dc:date>2026-05-04T02:25:59+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://dsss.be/w/python:colorization_and_tab_completion_for_the_python_shell?rev=1345004404&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:defer_to_another_program_in_the_path_if_available?rev=1346255004&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:index?rev=1720535337&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:intvectorrange?rev=1348603494&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:optparse?rev=1307320808&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:progress_bar?rev=1346373207&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:simple_dyndns_updater?rev=1345064095&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:socksv4_proxy?rev=1305924648&amp;do=diff"/>
                <rdf:li rdf:resource="https://dsss.be/w/python:virtualenv?rev=1294267698&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://dsss.be/w/_media/wiki:dokuwiki.svg">
        <title>Tyler's wiki</title>
        <link>https://dsss.be/w/</link>
        <url>https://dsss.be/w/_media/wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://dsss.be/w/python:colorization_and_tab_completion_for_the_python_shell?rev=1345004404&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-08-15T04:20:04+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>colorization_and_tab_completion_for_the_python_shell</title>
        <link>https://dsss.be/w/python:colorization_and_tab_completion_for_the_python_shell?rev=1345004404&amp;do=diff</link>
        <description>Make a .pythonrc file:


# Python startup environment -- color prompt and tab completion
# 2012-08-14  --  Tyler Bletsch

import sys,os,re
import itertools

if sys.stdout.isatty():
	try:
		import readline
	except ImportError:
		print &quot;Module readline not available.&quot;
	else:
		import rlcompleter
		readline.parse_and_bind(&quot;tab: complete&quot;)

	# ANSI coloring with readline escape codes
	def c(s=&#039;&#039;): return &#039;\001\033[%sm\002&#039; % s  

	if os.environ.get(&#039;TERM&#039;) in (&#039;xterm&#039;, &#039;vt100&#039;):
		sys.ps1 = c(&#039;0;36;…</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:defer_to_another_program_in_the_path_if_available?rev=1346255004&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-08-29T15:43:24+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>defer_to_another_program_in_the_path_if_available</title>
        <link>https://dsss.be/w/python:defer_to_another_program_in_the_path_if_available?rev=1346255004&amp;do=diff</link>
        <description>Defer to another program in the PATH if available

Let&#039;s say you want a custom replacement for a program on systems that don&#039;t have it, but you want to use the native binary on systems that do.  Let&#039;s further assume that you want to put one file in your path everywhere and have it do the right thing (for example, if you&#039;re sharing an NFS home directory between diverse machines).  The</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:index?rev=1720535337&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-07-09T14:28:57+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>index</title>
        <link>https://dsss.be/w/python:index?rev=1720535337&amp;do=diff</link>
        <description>Python

	*  Python virtual environment recipe
	*  Colorization and tab completion for the python shell
	*  Defer to another program in the PATH, if available
	*  SOCKSv4 proxy - Simple proxy in pure python.
	*  virtualenv - A recipe to download and deploy Python 2.7 in your home directory without dependencies (except gcc)
	*  optparse
	*  IntVectorRange
	*  Progress bar
	*  Simple DynDNS updater


# use this like a dictonary (d[&#039;thing&#039;]) OR an object (d.thing)
class DictObject(dict):
    def __g…</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:intvectorrange?rev=1348603494&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-09-25T20:04:54+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>intvectorrange</title>
        <link>https://dsss.be/w/python:intvectorrange?rev=1348603494&amp;do=diff</link>
        <description># gives all possible integer vectors between two endpoints, inclusively.  For example:
# IntVectorRange([0,0,2], [1,1,3]) yields:
#   [0, 0, 2]
#   [1, 0, 2]
#   [0, 1, 2]
#   [1, 1, 2]
#   [0, 0, 3]
#   [1, 0, 3]
#   [0, 1, 3]
#   [1, 1, 3]
# if only one argument is given to __init__, then the range goes from [0,0,...,0] to the vector given
class IntVectorRange(object):
    def __init__(self,start,end=None):
        if end is None:
            end=start
            start=[0] * len(end)
 
      …</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:optparse?rev=1307320808&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-06-06T00:40:08+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>optparse</title>
        <link>https://dsss.be/w/python:optparse?rev=1307320808&amp;do=diff</link>
        <description>from optparse import OptionParser

things = {
        &#039;this_thing&#039;: this,
        &#039;that_thing&#039;: that,
        &#039;the_other&#039;: get_the_other(),
}
parser = OptionParser(&quot;Usage: %prog [options] &lt;files ...&gt;&quot;)

# uncomment if you need to ignore options after the first argument, e.g. &quot;mywrapper -x ls -l&quot;
# parser.disable_interspersed_args()

parser.add_option(&quot;-n&quot;, &quot;--number&quot;, dest=&quot;number&quot;, help=&quot;Quantity of things&quot;, metavar=&quot;NUM&quot;, type=&quot;int&quot;)
parser.add_option(&quot;-h&quot;, &quot;--host&quot;, dest=&quot;hostname&quot;, help=&quot;Hos…</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:progress_bar?rev=1346373207&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-08-31T00:33:27+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>progress_bar</title>
        <link>https://dsss.be/w/python:progress_bar?rev=1346373207&amp;do=diff</link>
        <description>Progress Bar for Console Programs as Iterator

From here.


import sys

def progressbar(it, prefix = &quot;&quot;, size = 60, show_every=1):
	count = len(it)
	def _show(_i):
		if _i % show_every != 0: return
		x = int(size*_i/count)
		sys.stdout.write(&quot;%s[%s%s] %i/%i\r&quot; % (prefix, &quot;#&quot;*x, &quot;.&quot;*(size-x), _i, count))
		sys.stdout.flush()
 
	_show(0)
	for i, item in enumerate(it):
		yield item
		_show(i+1)
	sys.stdout.write(&quot;\n&quot;)
	sys.stdout.flush()</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:simple_dyndns_updater?rev=1345064095&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2012-08-15T20:54:55+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>simple_dyndns_updater</title>
        <link>https://dsss.be/w/python:simple_dyndns_updater?rev=1345064095&amp;do=diff</link>
        <description>Syntax: dyndns-update.py &lt;user&gt; &lt;password&gt; &lt;host&gt; [ip]



import sys,os,re
import urllib,socket

def update(user,password,host,ip):
        url = &quot;http://%s:%s@members.dyndns.org/nic/update?hostname=%s&amp;myip=%s&quot; % (user,password,host,ip)
        return urllib.urlopen(url).read()

def local_ip():
        return socket.gethostbyname(socket.gethostname())

if len(sys.argv) &lt; 4:
        print &quot;Syntax: %s &lt;user&gt; &lt;password&gt; &lt;host&gt; [ip]&quot; % sys.argv[0]
        sys.exit(1)

(user,password,host) = sys.argv…</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:socksv4_proxy?rev=1305924648&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-05-20T20:50:48+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>socksv4_proxy</title>
        <link>https://dsss.be/w/python:socksv4_proxy?rev=1305924648&amp;do=diff</link>
        <description>This is a simple SOCKSv4 proxy written in pure python.  Suitable for use with browsers.


#!/usr/bin/python
import sys
import socket
import struct
import thread
from optparse import OptionParser

# Very simple multi-threaded SOCKSv4(a) proxy
# by Tyler Bletsch (Tyler.Bletsch at gmail dot com)

parser = OptionParser(&quot;Usage: %prog [options]&quot;)
 
parser.add_option(&quot;-p&quot;, &quot;--port&quot;, dest=&quot;listen_port&quot;, help=&quot;Port on which to listen (default: %default).&quot;, metavar=&quot;PORT&quot;, type=&quot;int&quot;, default=1080)
parser…</description>
    </item>
    <item rdf:about="https://dsss.be/w/python:virtualenv?rev=1294267698&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2011-01-05T22:48:18+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>virtualenv</title>
        <link>https://dsss.be/w/python:virtualenv?rev=1294267698&amp;do=diff</link>
        <description>The script below is a recipe to download and deploy Python 2.7 in your home directory without dependencies (except gcc).  It also uses virtualenv to deploy a virtual Python environment, then uses the included setuptools pip utility to install the numpy</description>
    </item>
</rdf:RDF>
