Skip to content

Instantly share code, notes, and snippets.

View mwnorman's full-sized avatar

Mike Norman mwnorman

  • Software Developer
  • Ottawa, Ontario, Canada
View GitHub Profile
@mwnorman
mwnorman / parse_aws_iam_arn
Created August 14, 2016 15:01
parse aws iam arn
#!/bin/sh
aws --profile $1 iam get-user | jq '.User | {accountName: .UserName, accountId : .Arn | match("(arn:aws:iam::)(\\d{12})").captures[1].string }'
@mwnorman
mwnorman / HelloResource.java
Created April 2, 2015 15:59
aol-microservices simpleserver test application
package com.windriver.simpleserver;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import com.aol.micro.server.auto.discovery.Rest;
@Rest
@Path("foo")
@mwnorman
mwnorman / dateFormat.js
Created July 22, 2013 14:50
test Javascript iso date rendering
/*
* ----------------------------------------------------------------------------
* Package: JS Date Format Patch
* Version: 0.9.11
* Date: 2012-04-12
* Description: In lack of decent formatting ability of Javascript Date object,
* I have created this "patch" for the Date object which will add
* "Date.format(dateObject, format)" static function, and the
* "dateObject.toFormattedString(format)" member function.
* Along with the formatting abilities, I have also added the
@mwnorman
mwnorman / gist:2024111
Created March 12, 2012 19:22
JavaCC grammar for PL/SQL DDL with choice conflict on keywords
options {
STATIC = false;
SUPPORT_CLASS_VISIBILITY_PUBLIC = true;
ERROR_REPORTING = false;
JAVA_UNICODE_ESCAPE = true;
UNICODE_INPUT = true;
NODE_USES_PARSER = false;
NODE_DEFAULT_VOID = true;
IGNORE_CASE = true;
VISITOR = true;
@mwnorman
mwnorman / TestParser.jjt
Created March 9, 2012 15:58
stripped down JavaCC grammar for TABLE ddl
options {
STATIC = false; SUPPORT_CLASS_VISIBILITY_PUBLIC = true;
ERROR_REPORTING = false; JAVA_UNICODE_ESCAPE = true;
UNICODE_INPUT = true; NODE_USES_PARSER = false;
NODE_DEFAULT_VOID = true; IGNORE_CASE = true;
VISITOR = true; LOOKAHEAD = 2;
FORCE_LA_CHECK = true;
}
PARSER_BEGIN(TestParser)
<?xml version="1.0" encoding="UTF-8"?>
<sessions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session xsi:type="database-session">
<name>ksat</name>
<logging xsi:type="eclipselink-log">
<log-level>ALL</log-level>
</logging>
<login xsi:type="database-login">
<platform-class>org.eclipse.persistence.platform.database.MySQLPlatform</platform-class>
<user-name>erik</user-name>
CREATE DATABASE db;
CREATE USER user IDENTIFIED BY PASSWORD 'password';
GRANT ALL ON db.* TO 'user'@'localhost';
GRANT ALL ON db.* TO 'user'@'%'; -- # support remote logins
A StoredProcedure in a PL/SQL package uses a PL/SQL record type for arguments:
CREATE OR REPLACE PACKAGE NEST_REC_PACKAGE AS
TYPE TEST_NEST_REC IS RECORD (
VALUE01 VARCHAR2(10),
VALUE02 NUMBER
);
TYPE TEST_REC IS RECORD (
COLUMN01 VARCHAR2(10),
COLUMN02 NUMBER,
from http://www.eclipse.org/forums/index.php?t=msg&th=164573&start=0&
Suppose we have an Address 'type' -
CREATE OR REPLACE TYPE ADDR_TYPE AS OBJECT (
STREET VARCHAR2(40),
CITY VARCHAR2(40),
PROV VARCHAR2(40)
)