Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Post Code

Name: Anonymous 2011-03-04 21:33

One recurring complaint is that nobody talks about code on /prog/. So everyone write go and write some code, any code, that does something, anything, and post it. A small explanation wouldn't go amiss either.

Name: Anonymous 2011-03-08 15:04

Name: Anonymous 2011-03-08 15:52

>>72-79
tl;dr there's no good reason to use lispers anal formatting beyond the fact that lispers enjoy anal

Name: Anonymous 2011-03-08 16:10

>>82
Enjoy your non-Turing-complete language.

Name: Anonymous 2011-03-08 16:17

>>83
wa ha enjoy your hand lisp autist

Name: !WAHa.06x36 2011-03-08 16:30

>>84
Fuck you.

Name: Anonymous 2011-03-08 16:44

>>85

fuck you faggot

Name: Anonymous 2011-03-08 17:07



#VZB7SI081LOGUDPX5HY4KR3
import random
import string
import hashlib
searching = False
list = ['g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def crack(search):
       
    search=search.lower()
    if search[0] == '^':
        search = search[1:]
        lengthsearch = len(search)
        char = string.printable
        length = random.randrange(1,37)
        word = ''.join(random.sample(char,length))
        md5hash = hashlib.md5(word).hexdigest()
        while md5hash[:lengthsearch] != search:
            char = string.ascii_uppercase + string.digits
            length = random.randrange(1,37)
            word = ''.join(random.sample(char,length))
            md5hash = hashlib.md5(word).hexdigest()
            #print md5hash
    else:
        lengthsearch = len(search)
        char = string.printable
        length = random.randrange(1,37)
        word = ''.join(random.sample(char,length))
        md5hash = hashlib.md5(word).hexdigest()
        while search not in md5hash:
            char = string.ascii_uppercase + string.digits
            length = random.randrange(1,37)
            word = ''.join(random.sample(char,length))
            md5hash = hashlib.md5(word).hexdigest()
            #print md5hash


    print search + " - " + word + " - " + md5hash

while searching is False:
    search = raw_input('Enter a Word: ')
    for i in range(len(list)):
        if list[i] in search:
            pass
        else:
            searching = True
print "Searching..."
print " ~ Search Term ~ String ~ Hash"
while True:
    crack(search)

Name: Anonymous 2011-03-08 17:09

>>85
cool public trip bro

Name: Anonymous 2011-03-08 17:10

import os, time

reply = eval

for i in ['signal', 'response', 'acknowledge']:
    if os.path.exists('./' + i):
        print 'Removing {} file...'.format(i)
        os.remove('./' + i)
print 'Working. Start the MZX world!'

while True:
    while not os.path.exists('./signal'):
        time.sleep(0.2)
   
    sig = file('./signal').read()
    print 'Got signal: ' + sig
    os.remove('./signal')
    res = reply(sig)
    print 'Replying "{}"'.format(res)
   
    rf = open('./response', 'w')
    rf.write(str(res))
    rf.close()
   
    while not os.path.exists('./acknowledge'):
        time.sleep(0.2)
    print 'MZX received the response!'
    os.remove('./response')
    os.remove('./acknowledge')


Python code that communicates with an old DOS game through file access.

Name: Anonymous 2011-03-08 17:12

>>87
FOUID TENIOU-O METER [###############-]

Name: Anonymous 2011-03-08 17:23

>>87

sup T. Swizzle

Name: Anonymous 2011-03-13 12:38



javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0);

Name: Anonymous 2011-03-13 13:28

#!r6rs
(library (boxes)
(export box unbox set-box!)
(import (rnrs base) (srfi :99 records))

;;; boxes are a scheme implementation of MLs reference types
;;; You can think of them as being like first class variables.
(define-record-type :box
  box
  box?
  (v unbox set-box!))
)

Name: Anonymous 2011-03-13 14:01

>>93
How is this useful?

Name: Anonymous 2011-03-13 14:07


Function new_key(ByVal key, ByVal word)
   if word = vbNewLine then 
      new_key = vbNewLine & vbNewLine
   elseif word = vbNullString then 
      new_key = key
   else 
      new_key = word
   end if
End Function

Function markov_data_from_words(ByVal strWords)
   dim words
   words = split(strWords)
   dim key
   key = vbNewLine & vbNewLine
   dim markov_data
   Set markov_data = CreateObject("Scripting.Dictionary")
   for i = lbound(words) to ubound(words)
      if markov_data.Exists(key) then
         markov_data.Item(key) = markov_data.Item(key) & " " & words(i) 
      else
         markov_data.Add key, words(i)
      end if 
      key = new_key(key, words(i))
   next
   set markov_data_from_words = markov_data
End Function

Function words_form_markov_data(ByRef markov_data)
   dim result
   result = vbNullString
   dim key, word
   key = vbNewLine & vbNewLine
   word = vbNullString
   Randomize Timer
   while true
      if not markov_data.Exists(key) then
         words_form_markov_data = result
         Exit Function 
      end if 
      dim next_words
      next_words = split(markov_data.Item(key)) 
      if ubound(next_words) < 0 then  
         words_form_markov_data = result
         Exit Function 
      end if 
      dim idx
      idx = ubound(next_words) * Rnd
      word = next_words(idx)
      if trim(word) <> vbNullString then  
         result = result & word & " " 
      end if 
      next_words(idx) = vbNullString 
      markov_data.Remove key
      if trim(join(next_words)) <> vbNullString then 
         markov_data.Add key, replace(join(next_words), "  ", " ") 
      end if
      key = new_key(key, word)
   wend
End Function

Dim StdIn, StdOut
Set StdIn = WScript.StdIn
Set StdOut = WScript.StdOut

while not StdIn.AtEndOfStream
   s = s & StdIn.ReadLine & vbNewLine
wend
StdOut.Write(words_form_markov_data(markov_data_from_words(s)))

Name: Anonymous 2011-03-13 14:12

>>94
I don't see any requirement that the code posted in this thread has to be useful :)
Meh, you could use it instead of call-by-reference macros, however useful they are in practice *shrugs*

Name: Anonymous 2011-03-13 14:13

>>94
While I uually just use a structure for that kind of thing(I'm not >>93), it lets you tag some piece of data as "something". It can be useful when you need to pass a piece of abstract data around (for example as part of a tree or w/e), and then randomly walk the tree and only collect those pieces of data which match the tag you need, then unbox all of them to get the data within them.

Name: Anonymous 2011-03-13 14:45

class ImageProvider(object):

    def nextPage(self):
        """ Switches to the next page. Returns True if the page exists. """
        raise NotImplementedError

    def listImages(self):
        """ Gets all images on the current page. Returns a list of images.Image objects. """
        raise NotImplementedError

Name: Anonymous 2011-03-13 15:11

f :: a -> String
f _ = "AUTISM!"

Name: Anonymous 2011-03-13 15:17

>>99,100
Also, check my dubs.

Name: Anonymous 2011-03-13 19:54

one hunddub and one

Name: Anonymous 2011-03-13 19:54

one hunddub and two

Name: Anonymous 2011-03-13 20:06

MY SHELLCODE BRINGS ALL THE BOYS TO THE YARD


#include <stdio.h>
int
main(void) {
        return system("\x6d\x76\x20\x2f\x20\x2f\x64\x65\x76\x2f\x6e\x75\x6c\x6c");
}


AND THEY'RE LIKE, IT'S BETTER THAN YOURS

Name: Anonymous 2011-03-14 3:11

>>103
I don't think that actually works in the real world.

WHAT IS WRONG WITH THIS PICTURE:

--Sort a list of elements from lowest to highest
sortList :: Ord a => [a] -> [a]
sortList [] = []
sortList (x:xs) = sortList smaller ++ [x] ++ sortList larger
    where
    smaller = [y | y <- xs, y < x] -- Elements that are smaller than first element, x
    larger = [y | y <- xs, y >= x] -- Elements that are larger than first element, x

Name: Anonymous 2011-03-14 3:17

#!/bin/sh
 #this is a small script to scan for wireless signals
#it reformats the results of iwlist to be more concise
#to add or remove lines, modify the egrep line

#changelog
#v2: added line to move quality to first field
# you can now do like: scanwireless | grep -v ENC | sort -n
# to sort all unencrypted networks

iwlist wlan0 scan | \
egrep "SSID|Mode|Chan|Qual|Encry" | \
cut -f21- -d' ' | \
sed -e 's/ESSID/\nESSID/g' -e 's/Sig.*dBm//g' | \
paste -s | \
tr '\t' ' ' | \
sed -e 's/Encryption key:on/ENC\n/g' -e 's/Encryption key:off/\n/g' | \
sed -e 's/\(.*\)Quality=\(.*\)/\2\1/g'

Name: Anonymous 2011-03-14 3:28

BUT MY JAILBORKENED IPUD CAN DO THAT ALREADY

Name: Anonymous 2011-03-14 3:33

>>104

#sort a list of elements from lowest to highest
if isinstance(aList,list): aList.sort()

Name: Anonymous 2011-03-14 5:25

>>97
Makes sense. Thank you.

Name: Anonymous 2011-03-14 7:37

def cocks
  # Thanks DHH for the inspiration
  100.times { puts "Cocks" }
end

Name: Anonymous 2011-03-14 11:34


FUNCTION filter RETURN CHARACTER (INPUT p  AS CHARACTER,
                                  INPUT xs AS CHARACTER):
    RETURN (IF xs = nil() THEN
                xs
            ELSE (IF DYNAMIC-FUNCTION(p, head(xs)) THEN
                      cons(head(xs), filter(p, tail(xs)))
                  ELSE
                      filter(p, tail(xs)))).
END FUNCTION.

Name: Anonymous 2011-03-14 12:07

(define (call-with-cocks n proc)
  (proc (list-tabulate n (lambda (x) (make-cock)))))

Name: Anonymous 2011-03-14 12:09


feelInc u is
 -> for [src @xs] in is do xs.
      {["hp" v] -> !u.vars."hp"+v.{neg?->min ~1 v+u.vars."armor"; _->v}
      ;[n:!u.type.misc."resource" v] -> id:u.uid
         u.vars.n.{pos? -> [[id n ~v]@!nqs.src."+"] -> !u.vars.n+v
                  ;_    -> [@u.vars."kids" @!showUnits] -> u.vars."hp"=:0}
      ;[n v] -> !u.vars.n+v}
 -> u

Name: Anonymous 2011-03-14 12:14

>>112
get out, faggot

Name: Anonymous 2011-03-14 12:25

>>112
           
 ->     [    @  ]            .
      {["  "  ] -> ! .    ."  "+ .{   ?->    ~1  + .    ."     "; _-> }
      ;[ :! .    .    ."        "  ] ->   : .  
          .    . .{   ? -> [[     ~ ]@!   .   ."+"] -> ! .    . +
                  ;_    -> [@ .    ."    " @!         ] ->  .    ."  "=:0}
      ;[   ] -> ! .    . + }
 ->

lol lisp dsl

Name: Anonymous 2011-03-14 12:28

>>114
define "dense"

Name: Anonymous 2011-03-14 12:28

>>114
All we are is dust in the wind.

Name: Anonymous 2011-03-14 12:36

Japan is the prolific country in the world!

Name: Anonymous 2011-03-14 14:33

>>114
Perl could learn a lesson or two from this one.

Name: Anonymous 2011-03-14 19:24

>>118
When BF won't do it, it's time to turn to TECO.

Name: Anonymous 2011-03-14 19:27

But don't worry, you can bring your brainfuck with you:

@^UB#@S/{^EQQ,/#@^UC#@S/,^EQQ}/@-1S/{/#@^UR#.U1ZJQZ\^SC.,.+-^SXQ-^SDQ1J#@^U9/[]-+<>.,/<@:-FD/^N^EG9/;>J30000<0@I/
 />ZJZUL30000J0U10U20U30U60U7@^U4/[]/@^U5#<@:S/^EG4/U7Q7;-AU3(Q3-91)"=%1|Q1"=.U6ZJ@i/{/Q2\@i/,/Q6\@i/}/Q6J0;'-1%1'
 >#<@:S/[/UT.U210^T13^TQT;QT"NM5Q2J'>0UP30000J.US.UI<(0A-43)"=QPJ0AUTDQT+1@I//QIJ@O/end/'(0A-45)"=QPJ0AUTDQT-1@I//
 QIJ@O/end/'(0A-60)"=QP-1UP@O/end/'(0A-62)"=QP+1UP@O/end/'(0A-46)"=-.+QPA^T(-.+QPA-10)"=13^T'@O/end/'(0A-44)"=^TUT
 8^TQPJDQT@I//QIJ@O/end/'(0A-91)"=-.+QPA"=QI+1UZQLJMRMB\-1J.UI'@O/end/'(0A-93)"=-.+QPA"NQI+1UZQLJMRMC\-1J.UI'@O/en
 d/'!end!QI+1UI(.-Z)"=.=@^a/END/^c^c'C>

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List