Skip to content

Instantly share code, notes, and snippets.

View metafeather's full-sized avatar

Liam Clancy metafeather

View GitHub Profile
@metafeather
metafeather / POJOToJSON.mv
Created November 7, 2012 15:26 — forked from narenranjit/VelToJSON
Macros to convert Plain Old Java Objects in Velocity templates to JSON
#macro(POJOListToJSON $list )
#set($myList = $list )
{
#foreach($key in $myList.keySet())
#set($x = $myList.get($key))
"$key": #POJOToJSON($x) ##
#if($velocityCount != $myList.keySet().size())
,
#end
#end
@metafeather
metafeather / gist:6145895
Last active December 20, 2015 14:19
Selenium direct calls to page JS
Examples:
JSCover report, ref: http://tntim96.github.io/JSCover/manual/manual.xml
String json = selenium.getEval("selenium.browserbot.getUserWindow().jscoverage_serializeCoverageToJSON();");
Via SeleniumJQuery, ref: https://github.com/Nthalk/SeleniumJQuery/blob/master/example/com/anteambulo/SeleniumJQuery/example/Example.java
jq.query("[name=q]").val("SeleniumJQuery").parents("form:first").submit();
String results = jq.queryUntil("#resultStats:contains(results)").text();
@metafeather
metafeather / gist:6211148
Created August 12, 2013 14:12
Cross browser version of Date.now()
// 1*new Date() is a cross browser version of Date.now()
var d = 1*new Date()
@metafeather
metafeather / node-express-jsonstream.js
Last active August 29, 2015 13:57
Get, Parse and Transform JSONStreams on the fly before delivering to the browser
// Get, Parse and Transform JSONStreams on the fly before delivering to the browser
// ref: http://nodestreams.com/
var express = require('express'),
server = express();
var fs = require("fs"),
JSONStream = require("JSONStream"),
es = require('event-stream');
@metafeather
metafeather / execute_notebook.py
Last active August 29, 2015 14:03
IPython - executing other notebooks
import io
from IPython.nbformat import current
def execute_notebook(nbfile):
with io.open(nbfile) as f:
nb = current.read(f, 'json')
ip = get_ipython()
for cell in nb.worksheets[0].cells:
if cell.cell_type != 'code':
continue
@metafeather
metafeather / map.py
Created July 22, 2014 11:46
MapReduce in Python from JSON via stdin
#!/usr/bin/python
# MAPPER
# ref: http://open.blogs.nytimes.com/2014/07/10/emr-streaming-in-go/
import sys
import simplejson as json
def main():
@metafeather
metafeather / map.go
Last active August 29, 2015 14:04
MapReduce in Go from JSON via stdin
// MAPPER
// ref: http://open.blogs.nytimes.com/2014/07/10/emr-streaming-in-go/
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
local_client
server
client
ext
// run the following command in CMD to find the product key associated with your Windows installation:
wmic path softwarelicensingservice get OA3xOriginalProductKey
@metafeather
metafeather / urls.txt
Created February 1, 2017 15:45
Paths to test a web server with
/+CSCOE+/logon.html
/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/.%2e/etc/passwd
/.%2e/.%2e/.%2e/.%2e/windows/win.ini
/.%2e/.%2e/.%2e/.%2e/winnt/win.ini
/..../..../..../..../..../..../..../..../..../..../..../..../etc/passwd
/..../..../..../..../..../..../..../..../..../windows/win.ini
/..../..../..../..../..../..../..../..../..../winnt/win.ini
/.../.../.../.../.../.../.../.../.../windows/win.ini
/.../.../.../.../.../.../.../.../.../winnt/win.ini
/.bak/