Skip to content

Instantly share code, notes, and snippets.

@wytten
wytten / create.sh
Last active July 13, 2022 13:34
WebLogic domain creation
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Two args required e.g., ./create.sh DDS_Sup 7001"
exit 1
fi
domain="$1"
port="$2"
if [ -d "$domain" ]; then
@wytten
wytten / install.sh
Created July 13, 2022 13:17
WebLogic silent install on Linux
#!/bin/bash
export JAVA_HOME=/apps/WLS/java
export PATH=$JAVA_HOME/bin:$PATH
java -jar wls_121200.jar -silent -responseFile /apps/wls_121200-response.txt -invPtrLoc oraInst.loc
@wytten
wytten / jnettrace.pl
Created April 16, 2021 15:45
Transform JDBC URL's into proxy URL's for use with jnettrace.jar
#!/usr/bin/perl
use feature qw(say);
# This script can be used to transform JDBC URL's into proxy URL's for use with jnettrace.jar,
# and is based on Oracle support article:
# How to Perform the Equivalent of SQL*Net Client Tracing with Oracle JDBC Thin Driver (Doc ID 793415.1)
# For an alternative tracing approach based on java.util.logging, see:
# How to Trace the Network Packets Exchanged Between JDBC and the RDBMS (Doc ID 1050942.1)
$num_args = $#ARGV + 1;
@wytten
wytten / MapUtil.java
Created April 16, 2021 15:40
Given a Map, sort it by values to create a new LinkedHashMap that preserves this order
import java.util.*;
import java.util.Map.Entry;
/**
* Given a Map, sort it by values to create a new LinkedHashMap that preserves this order
*
* From: https://stackoverflow.com/questions/109383/sort-a-mapkey-value-by-values
* And: https://mkyong.com/java/how-to-sort-a-map-in-java/
*/
public class MapUtil {
@wytten
wytten / Bean2Excel.java
Last active June 1, 2020 17:53
Turn your JAVA Beans into a POI Excel Spreadsheet (@author Jeff Byrd)
/**
* Source: Turn your JAVA Beans into a POI Excel Spreadsheet http://www.dominotricks.com/?p=115
*
* @author Jeff Byrd
*
*/
public class Bean2Excel {
private HSSFWorkbook workbook;
private HSSFFont boldFont;
@wytten
wytten / gist:57babe6dd13dc8fea8a9a03e6dab265a
Last active January 23, 2020 14:40
bash function to print a range of lines defined by first and last occurrence of a pattern (e.g., dated log messages)
function ranger {
# print a range of lines defined by first and last occurence of pattern
local pattern="$1" && shift
local file="$1" && shift
if [ -z "$file" ] || [ $# -gt 0 ]; then
echo "Must specify one file exactly" >&2
return 1
fi
if [ ! -f "$file" ]; then
echo "$file: No such file or directory" >&2
@wytten
wytten / ActiveDirectory-timestamp.xls
Created December 6, 2019 13:35
lastLogon value of 131916035555254000 calculates out at 1/10/2019
=IF(A1>0,A1/(8.64*10^11) - 109205,"")
@wytten
wytten / df_all.sh
Created April 26, 2019 14:04
Build a spreadsheet of df output for a collection of servers
#!/bin/bash
# Read default value of $hosts from the file common, if it exists.
# If it exists it is also assumed to define the function die.
if [ -f common ]; then
. common
else
function die {
echo $1
exit 1
}
@wytten
wytten / two-main-jars-pom.xml
Created April 18, 2018 13:33 — forked from klausbrunner/two-main-jars-pom.xml
Creating two different executable JARs with dependencies from the same Maven project - same contents but different Main class in the manifest
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly1</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>