Skip to content

Instantly share code, notes, and snippets.

(ns lcm.utils.jython
"This NS has functionality for interop between jython and clojure"
(:require [clojure.tools.logging :as log]
[clojure.pprint :refer [pprint]]
[slingshot.slingshot :refer [throw+ try+]])
(:import [org.python.core
Py
JyAttribute
PyString
PyInteger
import threading
from _io import _IOBase
def create_gc():
io = _IOBase()
print io
del io
t = threading.Timer(0.001, create_gc)
t.start()
import httplib
for i in range(20):
conn = httplib.HTTPSConnection("www.python.org")
conn.request("GET", "/")
r1 = conn.getresponse()
print r1.status, r1.reason
print i
@nickmbailey
nickmbailey / socket_workout.py
Created November 11, 2015 19:10
Debugging jython issue.
"""
socket_workout is a short script designed to reproduce a socket behavior
difference between Jython and CPython.
"""
import socket
import errno
import threading
import traceback
import logging
logging.basicConfig(level=logging.DEBUG)
[Nicks-MacBook-Pro:12:39:13 HULK-73-hulk-bundle*] hulk-ui$ time npm install
> bufferutil@1.1.0 install /Users/nick/workspace/git/hulk/hulk-ui/node_modules/webpack-dev-server/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
@nickmbailey
nickmbailey / gist:aa15b923cb3b2f03b3d9
Created October 17, 2014 17:05
Spark Demo at Austin Cassandra Users meetup
Basics
scala> val daily = sc.cassandraTable("weathercql", "daily")
scala> daily.first()
scala> daily.cache()
scala> daily.first()
scala> daily.first()
Explore the data (what possible metrics do I have?)
[Nicks-MacBook-Pro:14:22:15] opscenterd$ python test.py
Unable to verify ssl certificate.
Received response
200
[Nicks-MacBook-Pro:14:22:52] opscenterd$