Skip to content

Instantly share code, notes, and snippets.

View libliflin's full-sized avatar

William Laffin libliflin

  • PwC
  • Kensington, Maryland
View GitHub Profile
@libliflin
libliflin / make_sql.cmd
Created July 29, 2016 04:38
Pull 616 Example SQL statements from the oracle 10g documentation.
@echo off
del examples-*
setlocal enableDelayedExpansion
rem wget -r -np https://docs.oracle.com/cd/B14117_01/server.101/b10759/statements_9014.htm#SQLRF01604
rem sift-tool.org
rem gnuwin32
rem sublime
rem lots of stackoverflow answers.
-- 211ms
-- sample taken from and tweaked:json.org/example.html
DECLARE
l_t clob;
l_json json;
BEGIN
l_t := '{"web-app": {
"servlet": [
{
"servlet-name": "cofaxCDS",
@libliflin
libliflin / JSON.parse-mico-benchmark.js
Last active June 29, 2016 16:35
7135; 74ms for 1000 passes.
var t = "{\"web-app\": {\n" +
" \"servlet\": [ \n" +
" {\n" +
" \"servlet-name\": \"cofaxCDS\",\n" +
" \"servlet-class\": \"org.cofax.cds.CDSServlet\",\n" +
" \"init-param\": {\n" +
" \"configGlossary:installationAt\": \"Philadelphia, PA\",\n" +
" \"configGlossary:adminEmail\": \"ksm@pobox.com\",\n" +
" \"configGlossary:poweredBy\": \"Cofax\",\n" +
" \"configGlossary:poweredByIcon\": \"/images/cofax.gif\",\n" +
@libliflin
libliflin / Searcher.java
Created April 3, 2016 07:48
Everything on stackoverflow didn't really factor in having to do it for alot of different strings in a file > 2MB. And writing this was faster than learning lucene.
import java.util.*;
import java.util.function.Function;
/**
* // todo: not threadsafe
* // todo: could be faster with regards to TLBs
* // todo: could multi-thread the indexer.
* // todo: index all the things; not just whole words.
* // todo: if you index all the things; a prefix tree would probably help; ESPECIALLY with space.
* // todo: charsequence: what's that?
@libliflin
libliflin / convert.go
Created March 24, 2016 02:38
Convert oracle html grammars to antlr4
package main
import (
"errors"
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
)
@libliflin
libliflin / RAINBOW.go
Last active December 25, 2015 02:42
Not really a rainbow.
func RAINBOW() []color.Color {
const (
paletteSize = 256
)
var palette [paletteSize]color.Color
// 1 0 0 : RED 1 +
// 1 1 0 : YELLOW 0 -
// 0 1 0 : GREEN 2 +
// 0 1 1 : TEAL 1 -
// 0 0 1 : BLUE 0 +
@libliflin
libliflin / mithril_onerror.js
Last active September 15, 2017 04:25
Skip opening devtools when programming mithril
/*
error method makes it so i don't have to open up dev tools to see what went wrong.
must be in different <script> from your app code.
I use it in combination with Auto Reload https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api
*/
window.onerror = function(msg, url, line, col, error) {
m.render(document,
m("html", [
m("body", [
m("table", [
@libliflin
libliflin / list.md
Last active March 24, 2016 02:37
Tools I use as a (Windows/Oracle) Java developer.