Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / datemathparser.js
Last active August 29, 2015 14:05
DateMathParser for JavaScript
var DateMathParser = function() {
return {
parse: function(match) {
var dt = new moment();
if (0 == match.length) {
return dt;
};
var splitter = new RegExp("([^/]*)([/]{0,1})([^\\-\\+]*)(.*)");
var pos = 0;
@terrancesnyder
terrancesnyder / gist:b4ef1acd7494b1b9aa78
Last active August 29, 2015 14:23
Useful bash for clearing solr index data
shopt -s globstar
find ./consumers_s*/**/data/* -type f -exec rm -rf {} \;
find ./consumers_s*/**/tlog/* -type f -exec rm -rf {} \;
find ./orders_s*/**/data/* -type f -exec rm -rf {} \;
find ./orders_s*/**/tlog/* -type f -exec rm -rf {} \;
find . -name '*.java' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@terrancesnyder
terrancesnyder / TOOLS.md
Last active September 16, 2015 15:47
System Developer Startup

Java/JDK

  • Download JDK 1.7 (JDK!!!)
  • Install to C:\opt\java\jdk1.7.xx install your JRE to C:\opt\java\jre1.7.xx
  • Update your environment to have JAVA_HOME = C:\opt\java\jdk1.7.xx and update your root to have PATH = ...;%JAVA_HOME%\bin
  • Validate you did it right by going to your shell and typing "java -version" You should get java version info.

Maven

  • Download and install the latest maven to C:\opt\maven
@terrancesnyder
terrancesnyder / jmxremote.access
Created May 24, 2011 21:57
jmxremote.access - file used to control JMX remote access for tomcat
<youruser> [readonly|readwrite]
@terrancesnyder
terrancesnyder / provision.sh.man
Created May 24, 2011 22:07
provision.sh.man - man page describing the provision.sh file
NAME
provision.sh - script that will provision a new tomcat instance
SYNOPSIS
provision.sh [create|delete] [port]
DESCRIPTION
The program is useful for creating or deleting instances of a tomcat
on a specific port following SpringSource recommendations.
@terrancesnyder
terrancesnyder / jmxremote.password
Created May 24, 2011 21:58
jmxremote.password - password file used to protect JMX exposed by tomcat
<yourusername> <yourpassword>
@terrancesnyder
terrancesnyder / ephemeral-x.sh
Created May 27, 2011 13:29
./ephemeral-x.sh selenium headless on linux
#!/bin/sh
# Start an ephemeral X server.
#
# This is useful for when you want to lauch an X server for a specific
# process. When that process exits, the X server will be killed.
#
XSERVER=Xvfb
WINMGR=
@terrancesnyder
terrancesnyder / install-selenium-grid-service.bat
Created May 27, 2011 20:42
selenium grid console on windows as service
# create server
cmd /c sc create SeleniumGrid binPath= "cmd /c ant -f \"C:\opt\selenium-grid-1.0.8\build.xml\" launch-hub " DisplayName= "Selenium Grid Server"
# create client
cmd /c sc create SeleniumGridClient binPath= "cmd /c ant -f \"C:\opt\selenium-grid-1.0.8\build.xml\" -Dport=4545 -Denvironment=*chrome launch-remote-control " DisplayName= "Selenium Grid Client"
# This doesn't work, want to create a tc7 server... sigh...
cmd /c sc create Tomcat binPath= "C:\opt\tomcat7\srvany.exe" start= "auto" DisplayName= "Apache Tomcat Server"
# Save this as tomcat-service.reg
@terrancesnyder
terrancesnyder / selenium-grid.sh
Created May 27, 2011 21:40
selenium autostart
#! /bin/sh
# Licensed to the Apache Software Foundation (ASF).
### BEGIN INIT INFO
# Provides: selenium-grid
# Required-Start: $network $syslog $remote_fs
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Short-Description: Selenium Grid Server