Python

Python Web Version

python web version(for administering the script remotely)

#!/usr/bin/env python
print 'Content-Type: text/html charset=utf-8'

print '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Superiority</title></head>
<body>
<h1>Arch is the best!</h1>
</body>
</html>
'''

~ ornitorrincos, 2008-05-14 14:07:02

Python Implementation

I decided to take it upon myself to port this wonderful program to a few other languages.

#!/usr/bin/python
print "Arch is the best!"

~ sco50000, 2008-05-14 14:26:12

GIMP Plugin

I need to contribute in a more meaningful way here. Ingredients: GIMP Python 3D modeler or image viewer that supports importing of .obj files An image saying "Arch is the best!" Place this script somewhere where GIMP can find it. Maybe your plug-in directory, or like I do, in a user defined Python directory. Please ignore the redundant math and amatuerish Python. Put your created image (see above edit) and place it in it's own directory for your own sanity. Go into that directory from the terminal and run (replace gimp-2.5 with gimp-2.4 if that's your version). This may take a bit depending on how fast your computer is. (Replace "base_image.png" with your image file. Keep the quotes): gimp-2.5 -inbdf '(python-fu-pic-to-obj RUN-NONINTERACTIVE "base_image.png" 10 )''(gimp-quit 1)' When finished, open the resulting file "base_image.png.obj" in your 3D modeler or viewer. WARNING: This is a severely high-poly image. Every pixel was mapped!

#! /usr/bin/env python
from gimpfu import *

def pic_to_obj(file_name, depth):
    
    if depth==0:
        depth = 1
    
    depth = float(1000/depth)
    
    FILE = open(file_name + ".obj", "w")
    firstline = "g " + file_name + ".obj\n\n"
    FILE.writelines( firstline )
            
    image = pdb.gimp_file_load(file_name, file_name)
    drawable = pdb.gimp_image_get_active_layer(image)
        
    if pdb.gimp_drawable_is_gray(drawable)!= True:
        pdb.gimp_image_convert_grayscale(image)
            
    width = pdb.gimp_image_width(image)
    height = pdb.gimp_drawable_height(drawable)
        
    for j in range(height):
        for i in range(width):
            num_channels, pixel = pdb.gimp_drawable_get_pixel(drawable, i, j)
            list = "\nv " + str(float(i)/10) + " " + str(float(j)/10) + " " + str(float(pixel[0])/depth)
            FILE.writelines(list) 
            
        
    FILE.writelines( "\n" )
        
    for l in range((width)*(height-1)-1):
        if((l+1)%width)!=0:
            list = "\nf " + str(l+1) + " " + str(l+2) + " " + str(l+width+2) + " " + str(l+width+1)
            FILE.writelines(list)
            
    

register(
  "pic_to_obj", "", "", "", "", "",
  "<Toolbox>/Xtns/Languages/Python-Fu/pic_to_obj", "",
  [
  (PF_STRING, "file_name", "file_name", "file_name"),
  (PF_FLOAT, "depth", "depth", "depth")
  ],
  [],
  pic_to_obj
  )

main()

~ skottish, 2008-05-14 14:42:49

PyGTK Implementation

Possibly not upholding the pricipal of "simplicity" that Arch loves.

#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk
import random

class ArchIsTheBest:
	def __init__(self):
		window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		window.set_title("Arch is the best!")
		window.set_size_request(500,250)
		window.connect("delete_event", self.delete_event)
		window.connect("destroy", self.destroy)
		
		vbox = gtk.VBox(False, 0)
		window.add(vbox)
		vbox.show()
		
		textview = gtk.TextView(buffer=None)
		textviewb = textview.get_buffer()
		textviewt = "Arch is the best"
		textviewb.set_text(textviewt)
		textview.set_editable(False)
		textview.set_cursor_visible(False)
		textview.set_wrap_mode(True)
		vbox.pack_start(textview, True, True, 0)
		textview.show()
		
		button = gtk.Button(stock=gtk.STOCK_CLOSE)
		button.connect("clicked", lambda w: gtk.main_quit())
		vbox.pack_start(button, False, False, 0)
		button.set_flags(gtk.CAN_DEFAULT)
		button.grab_default()
		button.show()
		
		window.show()

	def delete_event(self, widget, event, data=None):
		return False
	
	def destroy(self, widget, data=None):
		gtk.main_quit()

	def main(self):
		gtk.main()

if __name__ == "__main__":
	archisthebest = ArchIsTheBest()
	archisthebest.main()

~ Barrucadu, 2008-05-14 14:48:55

Python/Tk Gui

Promotes Arch in the form of an smexy Tk dialog. (disclaimer: Might contain newbie code)

#!/usr/bin/env python

import Tkinter as tk
from sys import exit

THE_BEST = 'Arch is the best!'

class Dialog(object):
	def __init__(self, label):
		self.label = label
		top = tk.Tk()
		f = tk.Frame(top)
		f.pack()
		l_msg = tk.Label(f, text=self.label)
		l_msg.pack()
		b_exit = tk.Button(f, text='Ya, rly!', command='exit')
		b_exit.pack()
		top.mainloop()


def main():
	Dialog(THE_BEST)

main()

~ Mr.Elendig, 2008-05-29 19:23:35