This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | |
} |