Python CGI script to display client's IP address
import cgi import os print "Content-type: text/html" print "" print cgi.escape(os.environ["REMOTE_ADDR"])
DZone Snippets > madphilosopher
11395 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Darren Paul Griffith http://madphilosopher.ca/
import cgi import os print "Content-type: text/html" print "" print cgi.escape(os.environ["REMOTE_ADDR"])
sox in.wav out.wav lowpass 4000 compand 0.1,0.3 -60,-60,-30,-15,-20,-12,-4,-8,-2,-7 -2
#!/bin/sh # GALLERATE: Turn a zip of images into a gallery. # From Jason Scott. http://ascii.textfiles.com/archives/000137.html if [ -f "$1" ] then rm -rf .galleryworld echo "[%] Preparting to squat out $1...." mkdir .galleryworld cd .galleryworld unzip -j "../$1" unrar e -ep "../$1" echo "[%] WHY DOES IT HURT!!!!" montage +frame +shadow +label -tile 7 *.JPG *.GIF *.gif *.jpg *.bmp *.png *.PNG *.BMP "../$1.jpg" cd .. rm -rf .galleryworld ls -l "$1.jpg" else echo "No such file, assmaster." fi
GALLERATE [file]
#!/usr/bin/env python '''Prints a list of URLs that are found in standard input. It will only find URLs between quotes ("" or '') and starting with http:// ''' import re import sys # Pattern for fully-qualified URLs: url_pattern = re.compile('''["']http://[^+]*?['"]''') # build list of all URLs found in standard input s = sys.stdin.read() all = url_pattern.findall(s) # output all the URLs for i in all: print i.strip('"').strip("'")
wget -O - http://madphilosopher.ca/ | ./url_scrape.py | sort | uniq
"""Scans a directory under /usr/ports/ and gives the portname and comment for each port found.""" import os import os.path import sys def findmakefiles(curdir): '''goes one level deep under curdir to find and act on the Makefiles.''' for name in os.listdir(curdir): pathname = os.path.join(curdir, name, 'Makefile') # COMMENTs are found in the Makefiles if os.path.isfile(pathname): processmakefile(name, pathname) def processmakefile(name, pathname): '''grabs the port's COMMENT from the Makefile.''' f = open(pathname) data = f.readlines() for line in data: if line[0:7] == 'COMMENT': try: comment = line.strip().split('\t')[1] # most COMMENTs are tab delimited except: comment = line.strip() # some are not, so just print the whole line print "%-15s %s" % (name, comment) f.close() def usage(): print 'Usage: portinfo.py /usr/ports/[category]' sys.exit(1) if __name__ == '__main__': # get directory from command line args = sys.argv[1:] if len(args) == 1: curdir = args[0] else: usage() ## curdir = '/usr/ports/security/' # scan this directory if os.path.isdir(curdir): findmakefiles(curdir) else: sys.stdout = sys.stderr print "'%s' is not a valid directory." % curdir usage()
#!/bin/sh lynx -dump -nolist -pseudo_inlines \ 'http://dictionary.reference.com/search?q='$1'&r=67' \ | tail -n +13 | less -r