summaryrefslogtreecommitdiff
path: root/impattern/im/cgi-bin
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-02-13 02:41:42 -0800
committeryo mama <pepper@scannerjammer.com>2015-02-13 02:41:42 -0800
commit64f41d53728a966f10aef6d7ffbc00853d754300 (patch)
tree082f17db25c61f66aec87dc47fbc208cb17ca168 /impattern/im/cgi-bin
parentfab0563ff31365c2396f7353679c8239aed3ce8b (diff)
fixed some basics
Diffstat (limited to 'impattern/im/cgi-bin')
-rw-r--r--impattern/im/cgi-bin/.gallery.cgi.swobin20480 -> 0 bytes
-rw-r--r--impattern/im/cgi-bin/.gallery.cgi.swpbin36864 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/.gallery.cgi.un~bin59038 -> 0 bytes
-rw-r--r--impattern/im/cgi-bin/.imditherconf.cgi.swobin12288 -> 0 bytes
-rw-r--r--impattern/im/cgi-bin/.imditherconf.cgi.swpbin12288 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/.imditherconf.cgi.un~bin51229 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/.queryTest.cgi.un~bin7485 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/.test.cgi.un~bin519 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/1.pngbin2482 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/db.py29
-rwxr-xr-ximpattern/im/cgi-bin/db.pycbin1515 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/downloader.py114
-rwxr-xr-ximpattern/im/cgi-bin/downloader.pycbin2923 -> 0 bytes
-rwxr-xr-ximpattern/im/cgi-bin/gallery.cgi474
-rwxr-xr-ximpattern/im/cgi-bin/imdither.cgi145
-rwxr-xr-ximpattern/im/cgi-bin/imditherconf.cgi23
-rwxr-xr-ximpattern/im/cgi-bin/imweb/databaser.py24
-rwxr-xr-ximpattern/im/cgi-bin/imweb/downImg55
-rwxr-xr-ximpattern/im/cgi-bin/imweb/downloader.py114
-rwxr-xr-ximpattern/im/cgi-bin/imweb/fieldstorager.py21
-rwxr-xr-ximpattern/im/cgi-bin/imweb/filenamer.py115
-rwxr-xr-ximpattern/im/cgi-bin/imweb/hexdirer.py38
-rwxr-xr-ximpattern/im/cgi-bin/imweb/saveImg48
-rwxr-xr-ximpattern/im/cgi-bin/pythonhelloworld.cgi5
-rwxr-xr-ximpattern/im/cgi-bin/queryTest.cgi9
-rwxr-xr-ximpattern/im/cgi-bin/test.cgi49
m---------impattern/im/cgi-bin/youtube-dl0
27 files changed, 0 insertions, 1263 deletions
diff --git a/impattern/im/cgi-bin/.gallery.cgi.swo b/impattern/im/cgi-bin/.gallery.cgi.swo
deleted file mode 100644
index 8e49f67..0000000
--- a/impattern/im/cgi-bin/.gallery.cgi.swo
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.gallery.cgi.swp b/impattern/im/cgi-bin/.gallery.cgi.swp
deleted file mode 100644
index f1e8117..0000000
--- a/impattern/im/cgi-bin/.gallery.cgi.swp
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.gallery.cgi.un~ b/impattern/im/cgi-bin/.gallery.cgi.un~
deleted file mode 100755
index 0720bde..0000000
--- a/impattern/im/cgi-bin/.gallery.cgi.un~
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.imditherconf.cgi.swo b/impattern/im/cgi-bin/.imditherconf.cgi.swo
deleted file mode 100644
index 1bbf2e2..0000000
--- a/impattern/im/cgi-bin/.imditherconf.cgi.swo
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.imditherconf.cgi.swp b/impattern/im/cgi-bin/.imditherconf.cgi.swp
deleted file mode 100644
index 7de91b5..0000000
--- a/impattern/im/cgi-bin/.imditherconf.cgi.swp
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.imditherconf.cgi.un~ b/impattern/im/cgi-bin/.imditherconf.cgi.un~
deleted file mode 100755
index bef4dd6..0000000
--- a/impattern/im/cgi-bin/.imditherconf.cgi.un~
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.queryTest.cgi.un~ b/impattern/im/cgi-bin/.queryTest.cgi.un~
deleted file mode 100755
index 31f6494..0000000
--- a/impattern/im/cgi-bin/.queryTest.cgi.un~
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/.test.cgi.un~ b/impattern/im/cgi-bin/.test.cgi.un~
deleted file mode 100755
index 769e9af..0000000
--- a/impattern/im/cgi-bin/.test.cgi.un~
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/1.png b/impattern/im/cgi-bin/1.png
deleted file mode 100755
index e98ec53..0000000
--- a/impattern/im/cgi-bin/1.png
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/db.py b/impattern/im/cgi-bin/db.py
deleted file mode 100755
index 4da7b83..0000000
--- a/impattern/im/cgi-bin/db.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import MySQLdb
-import time
-
-def now ():
- return int(time.mktime(time.localtime()))
-class db:
- def __init__ (self):
- self.conn = None
- self.cursor = None
- self.connect()
-
- def connect (self):
- self.conn = MySQLdb.connect (host = "127.0.0.1",
- user = "asdfus",
- passwd = "gTYgT&M6q",
- db = "asdfus")
- self.cursor = self.conn.cursor ()
-
- def execute (self,sql,args=()):
- try:
- self.cursor.execute(sql,args)
- except MySQLdb.Error, e:
- print "Error %d: %s" % (e.args[0], e.args[1])
- # sys.exit (1)
- self.connect()
- self.cursor.execute(sql,args)
-
- def lastinsertid (self):
- return DB.conn.insert_id()
diff --git a/impattern/im/cgi-bin/db.pyc b/impattern/im/cgi-bin/db.pyc
deleted file mode 100755
index 6347826..0000000
--- a/impattern/im/cgi-bin/db.pyc
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/downloader.py b/impattern/im/cgi-bin/downloader.py
deleted file mode 100755
index 7083b11..0000000
--- a/impattern/im/cgi-bin/downloader.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/python
-import random
-import urllib, urllib2
-urlopen = urllib2.urlopen
-Request = urllib2.Request
-import sys
-
-MAX_SIZE = 1024 * 1024 * 1.2
-
-###___this somewhat poorly written program basically performs a get request
-#you can specify three arguments, the url, the destination path and the filename#that you'll want your file to be called
-#these can be specified as argument values from the commandline or as
-#values in the mainfunction which is downloader.download(url,filename,destination)
-#the destination and filename arguments are optional
-
-
-
-url = ""
-destination = ""
-filename = ""
-
-def argval():
- global destination
- global url
- global filename
- stuff = sys.argv
- lenstuff = len(stuff)
- if lenstuff >= 4:
- getvalues()
- if lenstuff ==3:
- print str(lenstuff)
- url = sys.argv[-2]
- filename = sys.argv[-1]
- if lenstuff ==2:
- url = sys.argv[-1]
- destination = ""
- partz = url.split('/')
- filename = partz[-1]
- if lenstuff ==1:
- print 'please provide url'
- return None
- return url
-
-def getvalues():
- global url
- global destination
- global filename
- url = sys.argv[-3]
- destination = sys.argv[-1]
- filename = sys.argv[-2]
- if len(filename) == 0:
- partz = url.split('/')
- filename = partz[-1]
- if filename == "" or filename == None:
- partz = url.split('/')
- filename = partz[-1]
- return url
-
-def browser_request (url,data=None):
- headers = {
- 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
- 'Accept': '*/*',
- }
- try:
- req = Request(url, data, headers)
- response = urlopen(req)
- return response
- except:
- print "ERROR"
- sys.stdout.write('there is a problem with the url or an I/O error')
- return None
- sys.exit()
-
-
-def download(url, filename="",destination=""):
- response = browser_request(url)
- rawimg = response.read()
- if len(rawimg) == 0:
- print error("got zero-length file")
- sys.stdout.write("file did not exist or was zero-length")
- sys.exit()
- if len(rawimg) > MAX_SIZE and "asdf.us" not in url:
- error = "file too big: max size " + str(MAX_SIZE/1024) + " KB / " + filename + " is " + str(len(rawimg)/1024) + " KB"
- print error
- sys.stdout.write(error)
- sys.exit()
- if filename == "":
- partz = url.split('/')
- filename = partz[-1]
- path = ""
- if destination == "" or destination == '':
- path = filename
- else:
- path = destination+filename
- f = open(path, "w")
- f.write(rawimg)
- print 'success'
- f.close()
- finalitems = {}
- finalitems['url'] = url
- finalitems['filename'] = filename
- finalitems['destination'] = destination
- return finalitems
-
-def downloader():
- global url
- global destination
- global filename
- argval()
- finalitems = download(url, filename, destination)
- return finalitems
-
-if __name__ == '__main__':
- downloader()
diff --git a/impattern/im/cgi-bin/downloader.pyc b/impattern/im/cgi-bin/downloader.pyc
deleted file mode 100755
index 91ba5b0..0000000
--- a/impattern/im/cgi-bin/downloader.pyc
+++ /dev/null
Binary files differ
diff --git a/impattern/im/cgi-bin/gallery.cgi b/impattern/im/cgi-bin/gallery.cgi
deleted file mode 100755
index 0f762eb..0000000
--- a/impattern/im/cgi-bin/gallery.cgi
+++ /dev/null
@@ -1,474 +0,0 @@
-#!/usr/bin/python
-import os
-import cgi
-import re
-
-import random
-
-import db
-db = db.db()
-
-BASE_HREF = "http://i.asdf.us/im/"
-PARAMLIST = "addr start limit name interface random"
-LIMIT = 20
-
-def get_params (paramlist):
- paramkeys = paramlist.split()
- form = {}
- try:
- qs = os.environ['QUERY_STRING']
- except:
- qs = ""
- if len(qs):
- pairs = qs.replace("&amp;", "&").split("&")
- for pair in pairs:
- k,v = pair.split("=", 1)
- form[k] = v
- params = {}
- for key in paramkeys:
- if key in form:
- params[key] = sanitize(form[key])
- else:
- params[key] = None
- return params
-def sanitize (str):
- return re.sub(r'\W+', '', str)
-def get_files (params):
- sql = "SELECT * FROM im_cmd "
- args = []
- where = []
-
- if params['start'] is not None:
- where.append("id < %s")
- args.append(params['start'])
- if params['name'] is not None:
- where.append("name=%s")
- args.append(params['name'])
- if len(where):
- sql += "WHERE "
- sql += " AND ".join(where)
- sql += " "
-
- if params['random'] is not None:
- sql += "ORDER BY RAND() "
- else:
- sql += "ORDER BY id DESC "
- sql += "LIMIT %s"
-
- if params['limit'] is not None:
- args.append( int(params['limit']) )
- else:
- args.append( LIMIT )
- db.execute(sql, args)
- rows = db.cursor.fetchall ()
- return rows
-
-def is_image (img):
- if "jpeg" in img:
- return True
- if "jpg" in img:
- return True
- if "gif" in img:
- return True
- if "png" in img:
- return True
- return False
-
-
-params = get_params(PARAMLIST)
-
-titlephrase = random.choice([
- 'Keep on pickin\' on..',
- 'Pickolaus Pickleby by Charles Pickens!',
- 'You pick potato and I pick potahto...',
- 'Take your piq!',
- 'Show em what you got',
- 'I sure know how to pick \'em',
- 'Jus pick somethin already!',
- 'You can\'t pick your friends...',
- 'Select your image my liege',
- 'There\'s a time to choose...',
- 'gimme a choice! gimme lil\' choice-a-that...',
- 'You choose you lose',
- 'novels by James CHOICE...',
- 'Choose away, chooser-man...',
- ])
-
-print "Content-type: text/html"
-print "Pragma: no-cache"
-print
-print """
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
-"""
-print "<title>"+titlephrase+"</title>"
-print"""
-<style type="text/css">
-html,body{width:100%;height:100%;}
- """
-if params['interface'] is not None and params['interface'] == "off":
- print """
-body
- {
- background-color: white;
- padding: 0; margin: 0;
- }
-#images
- {
- margin: 12px 0 0 8px;
- }
-div, div img
- {
- padding: 0; margin: 0;
- margin-left: -4px;
- margin-top: -4px;
- }
-"""
-else:
- print """
-body
- {
- background-color: #eee;
- background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0.32, rgb(245,238,235)), color-stop(0.66, rgb(252,252,252)));
- background-image: -moz-linear-gradient( center bottom, rgb(245,238,235) 32%, rgb(252,252,252) 66%); overflow-y: scroll;
- }
-"""
-print """
-html
- {
- padding-bottom: 200px;
- }
-#images
- {
- width: 100%;
- }
-#images div
- {
- width: 200px;
- display: inline-block;
- }
-div img
- {
- max-width: 200px;
- max-height: 200px;
- border: 0;
- }
-#dump
- {
- position: fixed;
- left: 0;
- bottom: 10px;
- padding: 10px;
- width: 100%;
- border-bottom: 2px solid #000;
- background-color: #f8f8f8;
- border-top: 1px solid #888;
- }
-#dump #rebus
- {
- clear: right;
- width: 90%;
- max-height: 700px;
- overflow-y: scroll;
- background-color: #fff;
- padding-bottom: 5px;
- border-bottom: 1px solid #ddd;
- margin-bottom: 5px;
- }
-#dump #rebus img
- {
- display: inline;
- max-width: 400px;
- max-height: 400px;
- margin-right: -4px;
- }
-#dump #urlz
- {
- width: 90%;
- font-size: 15px;
- }
-#help
- {
- position: fixed;
- top: 10px;
- right: 10px;
- cursor: pointer;
- text-align: right;
- font-family: sans-serif;
- }
-#help b
- {
- padding: 5px;
- background-color: #f8f4fb;
- display: block;
- max-width: 160px;
- text-align: right;
- }
-#help b:hover
- {
- color: cyan;
-
- }
-#help #keys
- {
- clear: both;
- background-color: #f8f8f8;
- padding: 5px;
- display: none;
- width: 120px;
- font-size: 12px;
- }
-#nextpage
- {
- position: fixed;
- right: 160px;
- font-family: sans-serif;
- top: 10px;
- padding: 5px;
- background-color: rgba(255,255,255,0.7);
- }
-#nextpage a
- {
- color: #33f;
- }
-.rtlink
- {
- display: block;
- width: 100%;
- text-align: right;
- }
-#d_clip_container
- {
- display: inline-block;
- }
-#d_clip_button, #clear
- {
- font-family: Lucida Sans Unicode, Lucida Grande, sans-serif;
- color: #333;
- font-size: 13px;
- line-height: 13px;
- text-align: center;
- margin: 2px; padding: 5px;
- display: inline-block;
- border-top: 1px solid #888;
- border-left: 1px solid #888;
- border-right: 1px solid #555;
- border-bottom: 1px solid #333;
- background-image: linear-gradient(bottom, rgb(235,235,235) 0%, rgb(250,250,250) 53%);
- background-image: -o-linear-gradient(bottom, rgb(235,235,235) 0%, rgb(250,250,250) 53%);
- background-image: -moz-linear-gradient(bottom, rgb(235,235,235) 0%, rgb(250,250,250) 53%);
- background-image: -webkit-linear-gradient(bottom, rgb(235,235,235) 0%, rgb(250,250,250) 53%);
- background-image: -ms-linear-gradient(bottom, rgb(235,235,235) 0%, rgb(250,250,250) 53%);
- background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(235,235,235)), color-stop(0.53, rgb(250,250,250)));
- }
-#d_clip_button.hover, #clear:hover
- {
- color: #555;
- background-image: linear-gradient(bottom, rgb(245,240,245) 0%, rgb(255,255,255) 78%);
- background-image: -o-linear-gradient(bottom, rgb(245,240,245) 0%, rgb(255,255,255) 78%);
- background-image: -moz-linear-gradient(bottom, rgb(245,240,245) 0%, rgb(255,255,255) 78%);
- background-image: -webkit-linear-gradient(bottom, rgb(245,240,245) 0%, rgb(255,255,255) 78%);
- background-image: -ms-linear-gradient(bottom, rgb(245,240,245) 0%, rgb(255,255,255) 78%);
- background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(245,240,245)), color-stop(0.78, rgb(255,255,255)));
- }
-#d_clip_button.active, #clear:active
- {
- color: #111;
- border-top: 1px solid #333;
- border-left: 1px solid #555;
- border-right: 1px solid #555;
- border-bottom: 1px solid #333;
- background-image: linear-gradient(bottom, rgb(194,194,194) 0%, rgb(235,235,235) 53%);
- background-image: -o-linear-gradient(bottom, rgb(194,194,194) 0%, rgb(235,235,235) 53%);
- background-image: -moz-linear-gradient(bottom, rgb(194,194,194) 0%, rgb(235,235,235) 53%);
- background-image: -webkit-linear-gradient(bottom, rgb(194,194,194) 0%, rgb(235,235,235) 53%);
- background-image: -ms-linear-gradient(bottom, rgb(194,194,194) 0%, rgb(235,235,235) 53%);
- background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(194,194,194)), color-stop(0.53, rgb(235,235,235)));
- }
-</style>
-
-</head>
-<body>
-<div id="help">
- <b>key controls</b>
- <div id="keys">
- ESC toggle<br/>
- C clear<br/>
- R reverse<br/>
- BACKSPACE delete<br/>
- LEFT ARROW newer<br/>
- RIGHT ARROW older<br/>
- </div>
-</div>
-<div id="dump">
- <div id="rebus"></div>
- <input id="urlz" type="text" />
- <div id="d_clip_container" style="position:relative">
- <div id="d_clip_button">copy</div>
- </div>
- <button id="clear">clear</button>
-</div>
-<div id="images">
-"""
-
-
-files = get_files(params)
-count = 0
-for f in files:
- # url = BASE_HREF + f.replace(" ","%20")
- url = BASE_HREF + f[5] + "/" + f[7]
- print "<div><img src='%s'/></div>" % (url)
-print "</div>"
-
-lowest_id = files[-1][0]
-previous_id = lowest_id + (LIMIT * 2)
-back = ["start=%d" % lowest_id, "limit=%d" % LIMIT]
-newer = ["start=%d" % previous_id, "limit=%d" % LIMIT]
-random_time = []
-if params['name'] is not None:
- back.append("name=%s" % params['name'])
- newer.append("name=%s" % params['name'])
- random_time.append("name=%s" % params['name'])
-
-newer_QS = "&".join(newer)
-back_QS = "&".join(back)
-random_time_QS = "&".join(back)
-print "<div id='nextpage'>"
-print "<a href='?%s'>&larr; newer</a>" % newer_QS;
-print "|"
-print "<a href='/im/'>editor</a>"
-print "|"
-print "<a href='?random=1%s'>random</a>" % random_time_QS;
-print "|"
-print "<a href='?%s'>older &rarr;</a>" % back_QS;
-print "</div>"
-print """
-</body>
-<script type="text/javascript"></script>
-<script type="text/javascript" src="/js/jquery.js"></script>
-<script type="text/javascript" src="/js/ZeroClipboard.js"></script>
-<script type="text/javascript" src="http://asdf.us/js/pbembed.js"></script>
-<script type="text/javascript">
-ZeroClipboard.setMoviePath( 'http://asdf.us/swf/ZeroClipboard10.swf' );
-var clip = new ZeroClipboard.Client();
-clip.glue( 'd_clip_button' );
-var Dump =
- {
- pick: function ()
- {
- Dump.pickUrl( $(this).attr("src") )
- },
- pickUrl: function (url)
- {
- $("#rebus").append ($ ("<img>").attr ("src", url))
- $("#rebus").show()
- var theDump = $("#urlz").val() + " " + url
- $("#urlz").val( theDump )
- clip.setText( theDump )
- return false
- },
- clear: function ()
- {
- $("#rebus").html("")
- $("#urlz").val("")
- clip.setText("")
- },
- backspace: function ()
- {
- $("#rebus img:last").remove()
- var urllist = $("#urlz").val().split(" ")
- urllist.pop()
- $("#urlz").val( urllist.join(" ") )
- },
- reverse: function ()
- {
- urllist = $("#urlz").val().split(" ")
- Dump.clear()
- for (i in urllist.reverse())
- if (urllist[i])
- Dump.pickUrl(urllist[i])
- },
- showNewer: function()
- {
- window.location.href = '?"""+newer_QS+"""'
- },
- showOlder: function()
- {
- window.location.href = '?"""+back_QS+"""'
- }
- }
-var Main =
- {
- editing: false,
- kp: function (event)
- {
- console.log(event.keyCode);
- switch (event.keyCode)
- {
- // BS
- case 8:
- if (! Main.editing)
- Dump.backspace()
- return false
- // C
- case 67:
- if (! Main.editing)
- Dump.clear()
- break
- // R
- case 82:
- if (! Main.editing)
- Dump.reverse()
- break
- // ESC
- case 27:
- // H
- case 72:
- if (! Main.editing)
- $("#rebus").toggle()
- break
- // LEFT ARROW
- case 37:
- if (! Main.editing)
- Dump.showNewer()
- break
- // RIGHT ARROW
- case 39:
- if (! Main.editing)
- Dump.showOlder()
- break
- }
- return true
- },
- poll: function ()
- {
- },
- pollCallback: function ()
- {
- },
- init: function ()
- {
- $(document).keydown(Main.kp)
- $("#urlz").focus(function(){ Main.editing = true })
- $("#urlz").blur(function(){ Main.editing = false })
- $("#clear").live("click", Dump.clear)
- $("#help").click(function(){ $("#keys").toggle() })
- $("div img").live("click", Dump.pick)
- Dump.clear()
- }
- }
-"""
-if params['interface'] is not None and params['interface'] == "off":
- print """
-$("#nextpage,#help,#dump").hide()
-$("body").css({"margin": 0, "padding": 0, "overflow": hidden, "background-color": white})
-"""
-else:
- print "Main.init()"
-print """
-</script>
-</html>
-"""
-
diff --git a/impattern/im/cgi-bin/imdither.cgi b/impattern/im/cgi-bin/imdither.cgi
deleted file mode 100755
index 29837ed..0000000
--- a/impattern/im/cgi-bin/imdither.cgi
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/python
-
-import downloader
-import time
-import re
-import cgi
-from subprocess import Popen, PIPE, call
-from os import stat, path, makedirs
-import sys
-import sha
-BASE_DIR = ""
-OTHER_BASE = ""
-#BASE_DIR = "/var/www/asdf.us/httpdocs/im/"
-#OTHER_BASE = "http://asdf.us/im/"
-
-print "Content-Type: text/html"
-print ""
-print ""
-
-NAMETAG = "imDither"
-
-MAIN_DIRECTORY = ""
-#BIN_CONVERT = "/usr/bin/convert"
-#BIN_IDENTIFY = "/usr/bin/identify"
-#BIN_COMPOSITE = "/usr/bin/composite"
-BIN_CONVERT = "convert"
-BIN_IDENTIFY = "identify"
-BIN_COMPOSITE = "composite"
-
-NOW = str(int(time.time()))
-MAX_LENGTH_BEFORE_ABRIDGED = 30
-ABBREVIATION = "xx_abridged__"
-
-###################################
-### DEFAULT VALUES HERE
-params = {
- "url" : "http://asdf.us/im/10/friedeggstresstoy_1321140711_1322282769_pepper.gif",
- "ditherType" : "1.png",
- "username" : "pepper",
- "formatType" : "png",
-}
-###################################
-
-form = cgi.FieldStorage()
-if form:
- for key, value in form.iteritems():
- formValues[key] = params[key] #CHECKME
-
-class Utils:
- def file_size (self, imgFile):
- return stat(imgFile)[6]
-
- def imageDimensions(self, thefile):
- ident = Popen([BIN_IDENTIFY, thefile], stdout=PIPE).communicate()[0]
- parts = ident.split(" ")
- return parts[2].split("x")
-
- def hash_dir(self, s):
- """get a random number-letter pair"""
- return sha.new(s).hexdigest()[:2]
-
- def hexdir(self):
- """create a random path name"""
- directoryName = utils.hash_dir(NOW)
-
- dirs = [
- BASE_DIR+directoryName+'/',
- OTHER_BASE+directoryName+'/',
- ]
- ###################################
- if not path.exists(directoryName):
- makedirs(directoryName)
-
-
- return dirs
-
- def makeOriginalName(self, params, canvas_type="", nametag_part=""):
- if not nametag_part:
- nametag_part = NAMETAG
- if not canvas_type:
- canvastype = params["formatType"]
- filename = '%s_%s_%s.%s' % (nametag_part, NOW, params["username"], canvas_type)
- return filename
-
- def sanitize (self,string):
- """strip out all non-word characters"""
- return re.sub(r'\W+', '', string)
-
- def makeNameFromFilename(self, params):
- parts = params["url"].split("?")[0].split('/')
- filename = parts[-1]
- name, extension = filename.split('.')
- if len(extension) >= 5:
- sys.stdout.write('the file is not an image or any standard format')
- sys.exit()
- if len(name)> MAX_LENGTH_BEFORE_ABRIDGED:
- name = ABBREVIATION
- sanitized = self.sanitize(name)
- thefilename = "%s_%s_%s_%s.%s" % (NAMETAG, NOW, sanitized, params["username"], extension)
- return thefilename
-
-utils = Utils();
-
-
-class Dither:
- def makeCanvas(self, thefile):
- call([BIN_CONVERT,"-size", self.dimensions[0]+"x"+self.dimensions[1],"canvas:transparent", thefile])
- def makeMask(self, themask, thedither, thebackground):
- """ composite -tile DITHERNAME BACKGROUNDNAME MASKNAME """
- call([BIN_COMPOSITE,"-tile",thedither,thebackground,themask])
- #convert thebg.gif -compose Dst_In null: thefile.gif -matte -layers composite new.gif
- call([BIN_CONVERT,themask,"-compose","Dst_In","null:",self.privatepath+self.mainfile,"-matte","-layers","composite",themask])
- # os.system("rm "+thebackground)
- def fuseMask(self, themask, theimage):
- call([BIN_COMPOSITE,theimage,"-compose","Pin_Light",themask,theimage])
- # os.system("rm "+themask)
- def __init__(self, url, thedither, username):
- self.mainfile = utils.makeNameFromFilename(params)
- filepaths = utils.hexdir()
- self.privatepath = filepaths[0]
- self.publicpath = filepaths[1]
- downloader.download(url, self.mainfile, self.privatepath)
-
- parts = self.mainfile.split('.')
- print parts
- if "gif" in parts[-1]:
- canvastype = "gif"
- else:
- canvastype = "png"
-
- self.canvasfile = "/tmp/"+utils.makeOriginalName(params, canvastype, "canvasfile")
- self.dimensions = utils.imageDimensions(self.privatepath+self.mainfile)
- self.makeCanvas(self.canvasfile)
- self.theMask = "/tmp/"+utils.makeOriginalName(params, canvastype, "maskfile")
- #good up to here
- self.makeMask(self.theMask, thedither, self.canvasfile)
- self.fuseMask(self.theMask, self.privatepath+self.mainfile)
- #self.mainfile = self.mainfile.replace(, do something with s3)
- print self.privatepath+self.mainfile
- print utils.file_size(self.privatepath+self.mainfile)
- print 'width: '+self.dimensions[0]+'px'
- print 'height: '+self.dimensions[1]+'px'
-
-if __name__ == "__main__":
- newImage = Dither(params["url"], params["ditherType"], params["username"])
diff --git a/impattern/im/cgi-bin/imditherconf.cgi b/impattern/im/cgi-bin/imditherconf.cgi
deleted file mode 100755
index 8e7b7f2..0000000
--- a/impattern/im/cgi-bin/imditherconf.cgi
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-
-from subprocess import *
-import re
-print "Content-type: text/html\n\n"
-DITHERDIR = "/home/pepper/im/imdither/dithers";
-
-
-def get_ditherfiles():
- filesString = Popen(["ls", DITHERDIR], stdout=PIPE).communicate()[0]
- files = filesString.split("\n");
- #javascript = "var ditherfiles = ["
- javascript = "["
- for i in files:
- if not i:
- continue
- javascript += "\"%s\", " % (i);
-
- javascript = javascript[:-2]
- javascript += "]";
- return javascript
-print get_ditherfiles();
-
diff --git a/impattern/im/cgi-bin/imweb/databaser.py b/impattern/im/cgi-bin/imweb/databaser.py
deleted file mode 100755
index 07b8723..0000000
--- a/impattern/im/cgi-bin/imweb/databaser.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-
-from db import *
-import os
-DB = db ()
-
-PATH_TO_S3CMD = "/var/www/asdf.us/cgi-bin/im/s3/s3cmd-1.1.0-beta3/s3cmd"
-PATH_TO_IMAGES = "/var/www/asdf.us/docs/im"
-
-global idnumber
-
-function dbGet(idnumber):
- try:
- DB.cursor.execute('SELECT dir, newfile, id FROM im_cmd WHERE id='+id)
- #sql = "INSERT INTO im_cmd (date,remote_addr,name,dir,newfile,cmd) VALUES(%s,%s,%s,%s,%s,%s)"
- #args = (now(), remoteaddress, name, dir, newfile, cmd)
- data = cursor.fetchall
- print str(data)
- except ():
- return
-
-if __name__ == '__main__':
- sys.argv[1] = idnumber
- dbGet(idnumber) \ No newline at end of file
diff --git a/impattern/im/cgi-bin/imweb/downImg b/impattern/im/cgi-bin/imweb/downImg
deleted file mode 100755
index d029477..0000000
--- a/impattern/im/cgi-bin/imweb/downImg
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-
-import cgi
-import downloader
-import fieldstorager
-import sys
-import os
-#import gifchooser
-
-#BASE_DIR = "/var/www/asdf.us/httpdocs/imweb/"
-BASE_DIR = ""
-PARAM_LIST = "texture heightmap"
-#BIN_CONVERT = "/usr/bin/convert"
-BIN_CONVERT = "convert"
-
-print "Content-type: text/plain"
-print ""
-
-form = cgi.FieldStorage()
-newvalues = fieldstorager.fieldstorage(PARAM_LIST, form)
-thekeys = PARAM_LIST.split()
-for key in thekeys:
- globals()[key] = newvalues[key]
-########################################################
-#test with values here
-texture = "http://i.asdf.us/im/f3/imBreak_1327641897_clifford_1327640637_pepper.png"
-heightmap = "http://dump.fm/images/20120127/1327645413657-dumpfm-pepper-topcomments.png"
-#######################################################
-def uploadit(pictureUrl):
- if len(pictureUrl) > 3 and "." in pictureUrl:
- imageparts = pictureUrl.split('.')
- filetype = imageparts[-1]
- if "?" in filetype:
- theparts = filetype.split('?')
- filetype = theparts[0]
- if pictureUrl == texture:
- imagename = "Texture"
- if pictureUrl == heightmap:
- imagename = "Heightmap"
- if "png" in pictureUrl.lower() or "jpg" in pictureUrl.lower() or "jpeg" in pictureUrl.lower() or "gif" in pictureUrl.lower():
- downloader.download(pictureUrl, (imagename+"."+filetype), BASE_DIR)
- firstfile = BASE_DIR+imagename+"."+filetype
- endfile = BASE_DIR+imagename+"."+"jpg"
- os.system(BIN_CONVERT+" -resize 256x256\! "+firstfile+" "+endfile)
- if pictureUrl == "Heightmap":
- os.system(BIN_CONVERT+" colorspace -gray "+" "+endfile+" "+endfile)
- os.system("rm heightmap.png heightmap.gif texture.png texture.gif")
- print "upload"+imagename+" successful"
- return endfile
- else:
- print "This is not an acceptable image format for "+imagename
- return
-uploadit(texture)
-uploadit(heightmap)
-sys.exit()
diff --git a/impattern/im/cgi-bin/imweb/downloader.py b/impattern/im/cgi-bin/imweb/downloader.py
deleted file mode 100755
index 7083b11..0000000
--- a/impattern/im/cgi-bin/imweb/downloader.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/python
-import random
-import urllib, urllib2
-urlopen = urllib2.urlopen
-Request = urllib2.Request
-import sys
-
-MAX_SIZE = 1024 * 1024 * 1.2
-
-###___this somewhat poorly written program basically performs a get request
-#you can specify three arguments, the url, the destination path and the filename#that you'll want your file to be called
-#these can be specified as argument values from the commandline or as
-#values in the mainfunction which is downloader.download(url,filename,destination)
-#the destination and filename arguments are optional
-
-
-
-url = ""
-destination = ""
-filename = ""
-
-def argval():
- global destination
- global url
- global filename
- stuff = sys.argv
- lenstuff = len(stuff)
- if lenstuff >= 4:
- getvalues()
- if lenstuff ==3:
- print str(lenstuff)
- url = sys.argv[-2]
- filename = sys.argv[-1]
- if lenstuff ==2:
- url = sys.argv[-1]
- destination = ""
- partz = url.split('/')
- filename = partz[-1]
- if lenstuff ==1:
- print 'please provide url'
- return None
- return url
-
-def getvalues():
- global url
- global destination
- global filename
- url = sys.argv[-3]
- destination = sys.argv[-1]
- filename = sys.argv[-2]
- if len(filename) == 0:
- partz = url.split('/')
- filename = partz[-1]
- if filename == "" or filename == None:
- partz = url.split('/')
- filename = partz[-1]
- return url
-
-def browser_request (url,data=None):
- headers = {
- 'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
- 'Accept': '*/*',
- }
- try:
- req = Request(url, data, headers)
- response = urlopen(req)
- return response
- except:
- print "ERROR"
- sys.stdout.write('there is a problem with the url or an I/O error')
- return None
- sys.exit()
-
-
-def download(url, filename="",destination=""):
- response = browser_request(url)
- rawimg = response.read()
- if len(rawimg) == 0:
- print error("got zero-length file")
- sys.stdout.write("file did not exist or was zero-length")
- sys.exit()
- if len(rawimg) > MAX_SIZE and "asdf.us" not in url:
- error = "file too big: max size " + str(MAX_SIZE/1024) + " KB / " + filename + " is " + str(len(rawimg)/1024) + " KB"
- print error
- sys.stdout.write(error)
- sys.exit()
- if filename == "":
- partz = url.split('/')
- filename = partz[-1]
- path = ""
- if destination == "" or destination == '':
- path = filename
- else:
- path = destination+filename
- f = open(path, "w")
- f.write(rawimg)
- print 'success'
- f.close()
- finalitems = {}
- finalitems['url'] = url
- finalitems['filename'] = filename
- finalitems['destination'] = destination
- return finalitems
-
-def downloader():
- global url
- global destination
- global filename
- argval()
- finalitems = download(url, filename, destination)
- return finalitems
-
-if __name__ == '__main__':
- downloader()
diff --git a/impattern/im/cgi-bin/imweb/fieldstorager.py b/impattern/im/cgi-bin/imweb/fieldstorager.py
deleted file mode 100755
index 55b00ad..0000000
--- a/impattern/im/cgi-bin/imweb/fieldstorager.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/python
-
-def fieldstorage(paramlist, form):
- theparams = paramlist.split()
- newvalues = {}
- for item in theparams:
- if item in form:
- newvalues[item] = form[item].value
- else:
- newvalues[item] = None
- for item in theparams:
- if newvalues[item] is not None:
- if 'true' in newvalues[item] or 'True' in newvalues[item]:
- if len(newvalues[item]) <= 6:
- newvalues[item] = True
- elif 'false' in newvalues[item] or 'False' in newvalues[item]:
- if len(newvalues[item]) <= 7:
- newvalues[item] = False
- return newvalues
-
-
diff --git a/impattern/im/cgi-bin/imweb/filenamer.py b/impattern/im/cgi-bin/imweb/filenamer.py
deleted file mode 100755
index 9b6ef32..0000000
--- a/impattern/im/cgi-bin/imweb/filenamer.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import os
-import re
-import time
-import string
-import urllib
-import sha
-
-#this program takes a url and makes a new filename for it. it also
-#splits out the extension. this is important for manipulating images
-#it returns a hash, part[0] is the filename and part[1] is the extension
-#called like this filenamer.filename(url, nametag, username)
-
-
-thefilename = ""
-extension = ""
-
-nametag = ""
-username = ""
-url = ""
-
-def getargs():
- global username
- global nametag
- global url
- args = sys.argv
- if len(args) < 2:
- return None
- if len(args) >= 4:
- username = args[-1]
- nametag = args[-2]
- url = args[-3]
- if len(args) == 3:
- nametag = args[-1]
- url = args[-2]
- if len(args) == 2:
- url = args[-1]
- thereturn = {}
- thereturn['url'] = url
- thereturn['nametag'] = nametag
- thereturn['username'] = username
- return thereturn
-
-def sanitize (str):#this removes pretty much everything but letters(and underscores) from a url
- return re.sub(r'\W+', '', str)
-#def sanitize (str):
-# tmp_str = urllib.unquote(str)
-# return re.sub(r'\W+', '', tmp_str)
-
-
-
-
-def now ():
- return int(time.mktime(time.localtime()))
-
-def spliturl(url):
- if len(url) < 3 or '/' not in url:
- sys.stdout.write('you have not provided a url')
- print 'you have not provided a url'
- sys.exit()
- parts = url.split('/')
- namepart = parts[-1]
- importantparts = namepart.split('.')
- extension = importantparts[-1]
- if "?" in extension:
- querysplit = extension.split('?')
- extension = querysplit[0]
- if len(extension) >= 5:
- sys.stdout.write('the file is not an image or any standard format')
- print 'the file is not an image or any standard format'
- sys.exit
- namepart = importantparts[-2]
- if len(namepart)>50:
- namepart = "xx_abridged__"
- sanitized = sanitize(namepart)
- salvaged = {}
- salvaged['extension'] = extension
- salvaged['namepart'] = sanitized
- return salvaged
-
-def prepare(url):
- global nametag
- global username
- time = now()
- datestamp = str(time)
- parts = spliturl(url)
- extension = parts['extension']
- original = parts['namepart']
- thefilename = nametag+'_'+datestamp+"_"+original+"_"+username+'.'+extension
- return thefilename
-
-def filename(url, tag="", usrname=""):
- global nametag
- global username
- if tag == None:
- tag = ""
- if usrname == None:
- usrname = ""
- nametag = tag
- username = usrname
- thefilename = prepare(url)
- print thefilename
- return thefilename
- sys.exit()
-
-
-if __name__ == '__main__':
- vars = getargs()
- url=vars['url']
- nametag=vars['nametag']
- username = vars['username']
- filename(url,nametag,username)
-
diff --git a/impattern/im/cgi-bin/imweb/hexdirer.py b/impattern/im/cgi-bin/imweb/hexdirer.py
deleted file mode 100755
index af6f60e..0000000
--- a/impattern/im/cgi-bin/imweb/hexdirer.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import os
-import time
-import string
-import sha
-BASE_DIR = "/var/www/asdf.us/httpdocs/im/"
-OTHER_BASE = "http://asdf.us/im/"
-
-#THIS MODULE RETURNS A COMPLETE PATH! ALL YOU HAVE TO DO IS
-#SPECIFY THE BASE DIRECTORY
-#the hash works like this:
-#0 is private path
-#1 is the public path
-
-
-
-def hash_dir (s):
- return sha.new(s).hexdigest()[:2]
-
-def now ():
- return int(time.mktime(time.localtime()))
-
-def hexdir():
- time = now()
- time = str(time)
- ending = hash_dir(time)
- dirs = []
- dirs.append(BASE_DIR+ending+'/')
- dirs.append(OTHER_BASE+ending+'/')
- print str(dirs)
- return dirs
- sys.exit()
-
-if __name__ == "__main__":
- hexdir()
-
diff --git a/impattern/im/cgi-bin/imweb/saveImg b/impattern/im/cgi-bin/imweb/saveImg
deleted file mode 100755
index e76c36a..0000000
--- a/impattern/im/cgi-bin/imweb/saveImg
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-
-import hexdirer
-import filenamer
-import cgi
-import fieldstorager
-import base64
-import random
-import sys
-import databaser
-
-print "Content-type: text/plain"
-print ""
-
-nametag = "imWeb"
-#name is the image name
-
-PARAM_LIST = "name username picture"
-form = cgi.FieldStorage()
-newvalues = fieldstorager.fieldstorage(PARAM_LIST, form)
-thekeys = PARAM_LIST.split()
-for key in thekeys:
- globals()[key] = newvalues[key]
-if username == None:
- username = ""
-if name == None:
- name = str(random.randint(0,100))
-############################################################
-#test here
-###########################################################
-try:
- #the picture is first encoded so we have to decode it
- picture = base64.b64decode(picture)
- namepart = filenamer.filename(("/"+name+".png"),username,nametag)
- filepaths = hexdirer.hexdir()
- filepaths = ["",""]
-
- thefile = filepaths[0]+namepart
- f = open(thefile,'w')
- for line in picture:
- f.write(line)
- f.close()
-
-# databaser.database(filepaths[0],namepart,"imweb capture",username)
- print "capture successful"
- print filepaths[1]+namepart
-except:
- print "sorry, there is a problem with image capture"
diff --git a/impattern/im/cgi-bin/pythonhelloworld.cgi b/impattern/im/cgi-bin/pythonhelloworld.cgi
deleted file mode 100755
index cede50f..0000000
--- a/impattern/im/cgi-bin/pythonhelloworld.cgi
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-
-print "Content-type: text/html\n\n"
-print "<html>Hello world!</html>"
-
diff --git a/impattern/im/cgi-bin/queryTest.cgi b/impattern/im/cgi-bin/queryTest.cgi
deleted file mode 100755
index 5e6d573..0000000
--- a/impattern/im/cgi-bin/queryTest.cgi
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/perl
-
-use CGI;
-my $cgi = new CGI;
-print $cgi->header('text/html');
-print "what's up doc";
-#print( $cgi->param( "test" ));
-
-
diff --git a/impattern/im/cgi-bin/test.cgi b/impattern/im/cgi-bin/test.cgi
deleted file mode 100755
index 1159090..0000000
--- a/impattern/im/cgi-bin/test.cgi
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/perl
-
-print "Content-Type: text/html\r\n\r\nHello, world!\n";
-open MYFILE, ">/home8/basedxco/public_html/TESTFILE" or die $!;
-
-
-
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-print MYFILE "this is a test!!!!";
-close(MYFILE);
diff --git a/impattern/im/cgi-bin/youtube-dl b/impattern/im/cgi-bin/youtube-dl
deleted file mode 160000
-Subproject fc79158de2779a9f2d3fb16ddfb2878b82693b7