Skip to content

Instantly share code, notes, and snippets.

View jdrew1303's full-sized avatar
probably drinking coffee

James Drew jdrew1303

probably drinking coffee
View GitHub Profile
@jdrew1303
jdrew1303 / LDAPjs New User
Created May 12, 2018 00:02 — forked from pvencill/LDAPjs New User
Creating a new user in LDAPjs; complete example.
var ldap = require('ldapjs');
var ssha = require('node-ssha256');
var BASE = 'ou=Users,dc=example,dc=org';
// default port for ldaps
var URL = 'ldaps://ldap.example.org/:636';
// user and pass are for existing user with rights to add a user
@jdrew1303
jdrew1303 / seattlejs.js
Created May 12, 2018 00:00 — forked from mcavage/seattlejs.js
Example of running ldapjs over the GitHub API
var fs = require('fs');
var ldap = require('ldapjs');
var log4js = require('log4js');
var GitHubApi = require("github").GitHubApi;
///--- Globals
@jdrew1303
jdrew1303 / ldapjs-usage.js
Created May 12, 2018 00:00 — forked from thegoleffect/ldapjs-usage.js
basic ldapjs usage example
var LDAP = require('ldapjs');
var protocol = "ldap://";
var host = "...";
var post = 3268;
var dn = "cn=Van Nguyen,...";
var password = "some password";
var client = LDAP.createClient({
url: protocol + host + ":" + port
@jdrew1303
jdrew1303 / ldapjs-addrbook.js
Created May 11, 2018 23:59 — forked from dresende/ldapjs-addrbook.js
LDAP Addressbook using ldapjs
// MySQL test: (create on database 'abook' with username 'abook' and password 'abook')
//
// CREATE TABLE IF NOT EXISTS `users` (
// `id` int(5) unsigned NOT NULL AUTO_INCREMENT,
// `username` varchar(50) NOT NULL,
// `password` varchar(50) NOT NULL,
// PRIMARY KEY (`id`),
// KEY `username` (`username`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
// INSERT INTO `users` (`username`, `password`) VALUES
@jdrew1303
jdrew1303 / workbox.md
Created April 30, 2018 11:18 — forked from addyosmani/workbox.md
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
<aspect name="BookServiceLifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
<configuration type="literal">
<lifecycle>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="Acquisitions">
<state id="Acquisitions">
<datamodel>
<data name="checkItems">
<item name="Proposal Completed" forEvent="" />
<item name="Submit manuscript" forEvent="" />
<item name="Peer Review done" forEvent="" />
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="iso-8859-15" />
<xsl:template match="/">
<xsl:apply-templates select="´scxml" />
</xsl:template>
@jdrew1303
jdrew1303 / normalizeInitialStates.xsl
Created April 13, 2018 01:28 — forked from jbeard4/normalizeInitialStates.xsl
Normalize Initial States
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://www.w3.org/2005/07/scxml"
xmlns="http://www.w3.org/2005/07/scxml"
version="1.0">
<xsl:output method="xml"/>
<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
@jdrew1303
jdrew1303 / scxml_join_example.xml
Created April 13, 2018 01:24 — forked from jbeard4/scxml_join_example.xml
To emulate a "join" transition in SCXML, you can use a single "default transition" (a transition without a trigger) originating from the parallel state, and use a cond attribute with "In()" predicates for each parallel substate you wish you join. You can find the definition of a join transition in the following paper: http://citeseerx.ist.psu.ed…
<scxml>
<parallel id="P">
<state id="A">
<state id="A-start">
<transition target="A-done" event="t"/>
</state>
<state id="A-done"/>
</state>
<state id="B">
<state id="B-start">
@jdrew1303
jdrew1303 / AtmDisplay.java
Created April 13, 2018 01:23 — forked from ozkansari/AtmDisplay.java
Atm Status Finite State Machine Example using Apache Commons SCXML Library
package net.javafun.example.atmstatusfsm;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;