I hereby claim:
- I am seansummers on github.
- I am seansummers (https://keybase.io/seansummers) on keybase.
- I have a public key whose fingerprint is 69A9 3D5E 32A5 E596 F71C F241 1C35 48DF BC8A 5B0B
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
def loadJar(jarFile): | |
'''load a jar at runtime using the system Classloader (needed for JDBC) | |
adapted from http://forum.java.sun.com/thread.jspa?threadID=300557 | |
Author: Steve (SG) Langer Jan 2007 translated the above Java to Jython | |
Reference: https://wiki.python.org/jython/JythonMonthly/Articles/January2007/3 | |
Author: [email protected] simplified and updated for jython-2.5.3b3+ | |
>>> loadJar('jtds-1.3.1.jar') | |
>>> from java import lang, sql |
<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"> | |
<etl> | |
<description>Test Java Logging with Scriptella</description> | |
<connection id="jexl" driver="jexl"/> | |
<connection id="script" driver="script"/> | |
<script connection-id="script"> <!-- averages 20ms per call --> | |
etl.globals.put('nashornLOG', java.util.logging.Logger.getLogger('ETLscript')); | |
etl.globals.get('nashornLOG').info('This is a test from nashorn.'); | |
</script> | |
<script connection-id="jexl"> <!-- averages 3ms per call --> |
<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd"> | |
<etl> | |
<description>JEXL looping</description> | |
<properties><include href="etl.properties"/></properties> | |
<connection id="jexl" driver="jexl"/> | |
<connection id="sql" url="$url"/> | |
<query connection-id="jexl"> | |
fileDir = new('java.io.File', '.' + class:forName('java.io.File').separator + etl.getParameter('directory')).getCanonicalFile(); | |
if (fileDir.isDirectory() eq true) | |
for (sqlFile : fileDir.listFiles()) |
from com.pff import PSTFile, PSTObject | |
a = PSTFile('outlook.ost') | |
b = a.rootFolder | |
def walkFolders(folder): | |
print folder.descriptorNodeId, folder.displayName, folder.contentCount | |
if folder.hasSubfolders(): | |
for f in folder.subFolders: | |
walkFolders(f) |
PORT = 9123 | |
from org.apache import mina | |
from java import net, nio, util | |
class TimeServerHandler(mina.core.service.IoHandlerAdapter): | |
def exceptionCaught(self, session, cause): | |
cause.printStackTrace() | |
def messageSent(self, session, message): | |
print('Message written.... {}'.format(message)) |
#! /usr/bin/gawk | |
# RFC1071 Computing the Internet Checksum (in gawk) | |
# written by Sean Summers <[email protected]> 2015-09-15 v0.1 | |
# | |
# use '@include "internet_checksum.gawk"' to include in a script | |
function _ord_init(low, high, i, t) { | |
# creates _ord_ array for ascii lookup | |
low = 0; high = 127; | |
for (i = low; i <= high; i++) { |
#! /usr/bin/env python | |
from __future__ import print_function | |
import re | |
import hashlib | |
import collections | |
buffering = 2**29 | |
answer_re = r'^(?P<result>[^,]+),(?P<cpu_time>[\d\.]+),(?P<core>.+)' | |
core_line_re = r'(?P<facility_id>\d+):(?P<channels>(?:\d+[,;])+)' |
'''Wouldn't it be nice if sys.stdout knew how to redirect the JVM's stdout? Shooting star. | |
Author: Sean Summers <[email protected]> 2015-09-28 v0.1 | |
Permalink: https://gist.githubusercontent.com/seansummers/bbfe021e83935b3db01d/raw/redirect_java_stdout.py | |
''' | |
from java import io, lang | |
from contextlib import contextmanager | |
@contextmanager |
from pyparsing import Literal, nums, Word, Optional, Combine, delimitedList, Suppress | |
def parse_integer(s, l, t): | |
return int(t[0]) | |
def parse_integer_range(s, l, t): | |
x, y = t[0], t[-1] | |
x, y = min(x, y), max(x, y) + 1 |