Initial commit
This commit is contained in:
commit
818a107537
|
@ -0,0 +1,30 @@
|
|||
import os,subprocess
|
||||
|
||||
def get_input():
|
||||
return os.environ.get("QUERY_STRING","")
|
||||
|
||||
def line(type,text,selector="",host="",port="",skip=False):
|
||||
print("{}{}\t{}\t{}\t{}".format(type,text,selector,host,port))
|
||||
|
||||
def title(name):
|
||||
line("!",name)
|
||||
|
||||
def link_dir(text,selector,host="",port=""):
|
||||
line("1",text,selector,host,port)
|
||||
|
||||
def link(text,selector,host="",port=""):
|
||||
line("0",text,selector,host,port)
|
||||
|
||||
def text(text):
|
||||
line("i",text," ".strip(),"null.host","1")
|
||||
|
||||
def figlet(tex,**opts):
|
||||
if len(opts.keys())==0:
|
||||
opts = {"f":"standard"}
|
||||
ct = ["/usr/bin/figlet"]
|
||||
for k in opts:
|
||||
ct.append("-"+k)
|
||||
ct.append(opts[k])
|
||||
ct.append(tex)
|
||||
for line in subprocess.check_output(ct).decode("ascii").split("\n"):
|
||||
text(line)
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
|
||||
print("i{}\t\tnull.host\t1".format(os.environ["QUERY_STRING"]))
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
from gopher import *
|
||||
|
||||
figlet("libgopher",f="slant")
|
||||
text("")
|
||||
text("libgopher is a python lib for making")
|
||||
text("gopher CGI scripts. it defines functions")
|
||||
text("which allow for easy formatting of output.")
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
|
||||
print("iuptime\t\tnull.host\t1")
|
||||
res = subprocess.check_output("uptime",shell=True).decode("utf-8").strip()
|
||||
print("i{}\t\tnull.host\t1".format(res))
|
Loading…
Reference in New Issue