Skip to content

Instantly share code, notes, and snippets.

# context: http://stackoverflow.com/questions/39448808/julia-tcp-server-and-connection
# Use fn to process messages from sock.
# Loop till sock is open and fn returns true.
function processor(fn, sock)
proc = true
try
while proc && ((nb_available(sock) > 0) || isopen(sock))
proc = fn(sock)
end
from django.conf import settings #for RECAPTCHA_PRIVATE key
def verify_recaptcha(request):
import urllib, urllib2, re
values = {
"privatekey": settings.RECAPTCHA_PRIVATE,
"remoteip": request.META['REMOTE_ADDR'],
"challenge": request.POST['recaptcha_challenge_field'],
"response": request.POST['recaptcha_response_field'],
}