Skip to content

Instantly share code, notes, and snippets.

View djangofan's full-sized avatar

Jon Austen djangofan

View GitHub Profile
@djangofan
djangofan / get_home.bat
Created December 8, 2011 00:11
DOS batch file to find JAVA_HOME
@ECHO OFF
:: ------------------------------------------------------------------
:: JavaHome.bat - search for and set JAVA_HOME
:: 1. If JAVA_HOME is set in system environment, do nothing else.
:: 2. If javahome.txt already exists, use that value
:: 3. If those fail, search parent directories for java.exe
:: 4. Finally, try looking in the registry for other Java installations
:: Note- Script does not add trailing slash to JAVA_HOME variable
:: Note- JBINARY var can be set to JRE or JDK detection
:: ------------------------------------------------------------------
@djangofan
djangofan / trust_cacerts.bat
Created December 8, 2011 04:44
A batch file to import Java JRE cacerts into a jssecacerts file
@ECHO off
:: Script to import and trust CACERTS entries into the JSSECACERTS file
:: run this file from a Java servers home directory with no arguments
:: J_HOME is the parent directory of the directory you run your server out of.
:: assumes J_HOME/Javasoft might be your JRE home
::------
SETLOCAL EnableDelayedExpansion
SET fileobject=jars\myServer.jar
if defined J_HOME (
GOTO JREHOMESET
@djangofan
djangofan / ubuntu_commands.txt
Created December 8, 2011 05:28
Commands to install Oracle Java on Ubuntu
sudo apt-get install galternatives
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
(then use Gnome galternatives GUI to set the default)
OR on the pure command line:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
@djangofan
djangofan / start_Openfire.bat
Created December 11, 2011 04:03
Advanced script to start Openfire Chat server on Windows
@echo off
::-------------------------------------------------------------------
:: openfire_START.bat
:: The directory usually called "Openfire" is referred to as _SERVER_HOME
:: Script assumes these directories exist:
:: \Openfire , \Openfire\Javasoft, \Openfire\Databases, \Openfire\lib, \Openfire\plugins
::-------------------------------------------------------------------
setlocal
IF DEFINED SERVER_HOME (
ECHO SERVER_HOME is already set to %SERVER_HOME% from system environment
@ECHO off
SETLOCAL ENABLEDELAYEDEXPANSION
SET XMLFILE=plugins.xml
SET XMLBASE=//Config/Plugin
xmlstarlet.exe sel -t^
-c ^"%XMLBASE%/Instance/Project[@name='myapp']/DEBUG^" --nl^
-c ^"%XMLBASE%/Instance/Project[@name='myapp']/Company^" --nl^
-c ^"%XMLBASE%/Instance/Project[@name='myapp']/SaveOffline^" --nl^
-c ^"%XMLBASE%/Instance/Project[@name='myapp']/Client^" --nl^
-c ^"%XMLBASE%/Instance/Project[@name='myapp']/GPSDiscoverPort^" --nl^
@djangofan
djangofan / PropertyFileHandler.bat
Created January 9, 2012 03:49
DOS batch functions to handle editing property files.
@echo off &SETLOCAL ENABLEDELAYEDEXPANSION
:: Functions for updating property files
ECHO Args to script: %1 %2 %3
::---------------------------------------------------
:: Create test file if it doesn't exist
::---------------------------------------------------
IF NOT EXIST test.properties (
ECHO Key1=Value1>test.properties
ECHO #Key2=Value2>>test.properties
@djangofan
djangofan / LoadableComponentExample.java
Last active January 20, 2018 02:22
Using Java Selenium Webdriver and LoadableComponent to handle page changes
package qa.test;
/**
* Call this class with :
* ExpectedPage ep = new ExpectedPage().get();
* ep.method();
*
* /
public class ExpectedPage extends LoadableComponent<ExpectedPage> {
@djangofan
djangofan / wd.java
Created March 13, 2012 21:43 — forked from jarib/wd.rb
selenium-webdriver wait
public WebElement waitFindElement(WebDriver drv, By by, long timeout, long interval)
{
long start = System.currentTimeMillis();
while(true){
try{
return drv.findElement(by);
} catch(NoSuchElementException nse) {
if(System.currentTimeMillis()-start>=timeout)
{
throw new Error("Timeout reached and element["+by+"]not found");
@djangofan
djangofan / smb.conf
Created March 29, 2012 22:25
Samba config for allowing Windows users full public access to a share
security = share
guest account = publicuser
passdb backend = tdbsam
[publicuser]
comment = publicuser Home Dir
path = /home/publicuser
public = yes
writable = yes
write list = +publicuser
@djangofan
djangofan / smbusers
Created March 29, 2012 22:27
smbusers file sample
# Unix_name = SMB_name1 SMB_name2 ...
# root =
publicuser = Administrator smbguest pcguest guest
# nobody = guest pcguest smbguest