Skip to content

Instantly share code, notes, and snippets.

Jon Passki jonpasski

Block or report user

Report or block jonpasski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonpasski
jonpasski / bndtools_generate_p2.md
Last active Jan 12, 2017
Getting bndtools to generate a p2 repository
View bndtools_generate_p2.md

How to create a p2 repository from bndtools using as many off-the-shelf components as possible

This gist uses the gradle bnd-platform plugin, which creates a p2 repository based on user-supplied directives. To use this plugin in bndtools, bndtools recommends the following via its README:

If special Gradle build behavior is needed, beyond changes to the project's bnd.bnd file, then you should place a build.gradle file in the root of the project and place your customizations in there.

@jonpasski
jonpasski / Getting Xcore to Work in bndtools.md
Last active Oct 11, 2016
Getting Xcore to Work in bndtools
View Getting Xcore to Work in bndtools.md

My goal is to get Xcore to work in bndtools, broken up into two sub-goals:

  • Get Xcore to work via the Eclipse UI with bndtools
  • Get Xcore to work via Gradle on the command line

Getting Xcore to Work via Eclipse UI

High level:

  • Create and configure Xcore project
@jonpasski
jonpasski / gist:7916708
Created Dec 11, 2013
getRequestURI doesn't canonicalize the path :D
View gist:7916708
String uri = request.getRequestURI().substring(request.getContextPath().length());
if (!uri.startsWith(SOME_BASE_URL_THAT_SHOULD_REQUIRE_AUTHENTICATION))
{
// do security checks that seem reasonable...
}
else
{
// no authentication needed, proceed w/o security checks
chain.doFilter(request, response);
@jonpasski
jonpasski / gist:7642715
Created Nov 25, 2013
Worst (by my standards) python I've written in a while... I'm sure others hate different snippets more than this.
View gist:7642715
def __repr__(self):
_dict = {}
# Forgive me Guido, for I have sinned. eval is the shepherd I shall not want
# TODO, refactor
for result in self.results:
_dict.update(eval(repr(result)))
return str(_dict)
@jonpasski
jonpasski / gist:5599721
Created May 17, 2013
Disallowing XML external entities in Java SAXParserFactory
View gist:5599721
import javax.xml.parsers.ParserConfigurationException; // catching unsupported features
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXNotRecognizedException; // catching unknown features
import org.xml.sax.SAXNotSupportedException; // catching known but unsupported features
import org.xml.sax.XMLReader;
...
You can’t perform that action at this time.