Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Austen djangofan

View GitHub Profile
@djangofan
djangofan / get_home.bat
Created Dec 8, 2011
DOS batch file to find JAVA_HOME
View get_home.bat
@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 Dec 8, 2011
A batch file to import Java JRE cacerts into a jssecacerts file
View trust_cacerts.bat
@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 Dec 8, 2011
Commands to install Oracle Java on Ubuntu
View ubuntu_commands.txt
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 Dec 11, 2011
Advanced script to start Openfire Chat server on Windows
View start_Openfire.bat
@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
View gist:1511742
@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 Jan 9, 2012
DOS batch functions to handle editing property files.
View PropertyFileHandler.bat
@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 Jan 20, 2018
Using Java Selenium Webdriver and LoadableComponent to handle page changes
View LoadableComponentExample.java
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 Mar 13, 2012 — forked from jarib/wd.rb
selenium-webdriver wait
View wd.java
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 Mar 29, 2012
Samba config for allowing Windows users full public access to a share
View smb.conf
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 Mar 29, 2012
smbusers file sample
View smbusers
# Unix_name = SMB_name1 SMB_name2 ...
# root =
publicuser = Administrator smbguest pcguest guest
# nobody = guest pcguest smbguest