Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / datemathparser.js
Last active Aug 29, 2015
DateMathParser for JavaScript
View datemathparser.js
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 Aug 29, 2015
Useful bash for clearing solr index data
View gist:b4ef1acd7494b1b9aa78
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 {} \;
View fixspaces.sh
find . -name '*.java' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
@terrancesnyder
terrancesnyder / TOOLS.md
Last active Sep 16, 2015
System Developer Startup
View TOOLS.md

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
jmxremote.access - file used to control JMX remote access for tomcat
View jmxremote.access
<youruser> [readonly|readwrite]
@terrancesnyder
terrancesnyder / provision.sh.man
Created May 24, 2011
provision.sh.man - man page describing the provision.sh file
View provision.sh.man
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
jmxremote.password - password file used to protect JMX exposed by tomcat
View jmxremote.password
<yourusername> <yourpassword>
@terrancesnyder
terrancesnyder / ephemeral-x.sh
Created May 27, 2011
./ephemeral-x.sh selenium headless on linux
View ephemeral-x.sh
#!/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
selenium grid console on windows as service
View install-selenium-grid-service.bat
# 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
View selenium-grid.sh
#! /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