[Return] [Catalog]

1 guest@cc 1969-12-31T17:00:00
Python tripcodes

```
import crypt

def tripcode(pw):
pw = pw[:8]
salt = (pw + "H.")[1:3]
trip = crypt.crypt(pw, salt)
return trip[-10:]
```
»
2 guest@cc 1969-12-31T17:00:00
backlinks


import os
import re
from collections import defaultdict

def do_backlink(th='0'):
mt = load_thread(th) # here a thread is a list of replies.
bl = defaultdict(list)
for n, t in enumerate(mt):
repl = re.findall(r'\>\>[1-9][00-99]*', t)
repl = [r[8:] for r in repl if r]
for r in repl:
if int(r) >= len(mt) or str(n) in bl[r]:
continue
bl[r].append(str(n)) # generate the list of backlinks

for r in sorted([int(k) for k in bl.keys()]):
r = str(r)
return bl
[/code]

Then...

[code] # for each post in a thread

if str(post_number) in bl.keys():
print("<div class='bl'>Replies: ")
anchor = "<a href='#{0}'><i>&gt;&gt;{0}</a></i>"
print(", ".join([anchor.format(ref) \
for ref in bl[str(post_number)]]))
print("</div>")
»
3 guest@cc 1969-12-31T17:00:00
>>1
>>2
The tag is "cb" here, not "code".
»
4 OP#faggot 1969-12-31T17:00:00
>>3
You don't tell me what to do.

[Return] [Catalog]
Delete Post:
OptionsPassword
Name
Comment
File