Skip to content

Instantly share code, notes, and snippets.

View trplll's full-sized avatar

Luke trplll

  • Wisconsin
View GitHub Profile
@trplll
trplll / Groovy Jde Julian to Date
Created April 20, 2021 14:55
Groovy Jde Julian to Java Date Conversion
import java.text.ParseException;
import java.text.SimpleDateFormat;
class Main {
static void main(String... args) {
println JulianDateToJavaDate(121110)
}
public static Date JulianDateToJavaDate(Integer julianDate) {
Date date = null;
@trplll
trplll / JDE920-SubmittedJobs-Excecution-Details.sql
Created January 9, 2018 21:16
Submitted Job Details with hh:mm:ss job submit, start, and end times JDE920
SELECT A.JCJOBNBR,A.JCPROCESSID,TRIM( A.JCEXEHOST), B.JCPID, B.JCVERS, A.JCJOBQUE, A.JCJOBPTY, A.JCJOBSTS, A.JCENHV, A.JCUSER, A.JCJOBTYPE, A.JCSBMDATE, A.JCACTDATE,
--Convert JDE Submit Time hhmmss to hh:mm:ss
concat(concat(concat(concat( SUBSTR ((RIGHT (REPEAT ('0',6) || A.JCSBMTIME,6)),1,2),':'), SUBSTR ((RIGHT (REPEAT ('0',6) || A.JCSBMTIME,6)),3,2)),':'), SUBSTR ((RIGHT (REPEAT ('0',6) || A.JCSBMTIME,6)),5,2)) as SubTime,/*concat ss*/
--Convert IBM Start Time TimeStamp to hh:mm:ss and adjust for utc
case when(INTEGER(SUBSTR ((RIGHT (REPEAT ('0',6) || Replace(SUBSTR (B.JCSTDTIM,12,8),'.',''),6)),1,2))>=6)
then concat(concat(concat(concat( INTEGER(SUBSTR ((RIGHT (REPEAT ('0',6) || Replace(SUBSTR (B.JCSTDTIM,12,8),'.',''),6)),1,2)-6),':'), SUBSTR ((RIGHT (REPEAT ('0',6) || Replace(SUBSTR (B.JCSTDTIM,12,8),'.',''),6)),3,2)),':'), SUBSTR ((RIGHT (REPEAT ('0',6) || Replace(SUBSTR (B.JCSTDTIM,12,8),'.',''),6)),5,2))
else concat(concat(concat(concat( INTEGER(SUBSTR ((RIGHT (REPEAT ('0',6) || Replace
@trplll
trplll / JavaCalDateOffsetExample
Created August 31, 2017 19:21
Simple static method to return formatted string with today's date , or the date calculated based on an integer parameter
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class dateexample {
public static void main(String[] args) {
System.out.println(getdate());
System.out.println(getdate(0));
System.out.println(getdate(1));
System.out.println(getdate(-1));
@trplll
trplll / BasicBinaryTree.java
Created August 23, 2017 21:39
Basic Binary Tree DS in Java
package ds;
public class BasicBinaryTree<X extends Comparable<X>> {
private Node root;
private int size;
public BasicBinaryTree() {
this.root = null;
}
@trplll
trplll / js.modulus
Created August 23, 2017 05:51
Modulus example in js
<!DOCTYPE html>
<html>
<body>
<h2>The % Operator</h2>
<p id="demo"></p>
<p id="demo1"></p>
<p id="demo2"></p>
<p id="demo3"></p>
@trplll
trplll / BasicStack.java
Created August 16, 2017 03:36
Basic java Stack
public class BasicStack<X> {
private X[] data;
private int stackPointer;
public BasicStack() {
data = (X[]) new Object[1000];
stackPointer = 0;
}
public void push(X newItem) {
@trplll
trplll / sqlfilestotxtfile.ps1
Created June 27, 2017 20:26
Use Powershell to combine multiple SQL Files Into one Text File
$path = "C:\example"
$out = "C:\exampleout.txt"
Get-ChildItem $path -Filter *.sql| % {
$file = $_.Name
" " | Out-File -Append $out
"-----------------------------------" | Out-File -Append $out
"--${file}:" | Out-File -Append $out
" " | Out-File -Append $out
Get-Content $_.FullName | % {
//The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return true if we sleep in.
public boolean sleepIn(boolean weekday, boolean vacation) {
return !weekday||vacation ? true: false;
}
//Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.
@trplll
trplll / PS_Script_Extract_All_WSP_From_Current_SP_Farm.ps1
Created February 9, 2017 13:34
Extract solutions from a SharePoint Farm into dir
$dirName = "<directory path>"
Write-Host Exporting solutions to $dirName
foreach ($solution in Get-SPSolution)
{
$id = $Solution.SolutionID
@trplll
trplll / DecimalTimeToStringFmt.sql
Created December 13, 2016 01:47
IBM DB2 V6R10 Suppressed Zero Time FMT to Time String
SELECT
/*Tday Value as it appears in db*/
lmtday as tday,
' 24 HR Format hh:mm:ss ' as format1,
/*24 Hour Time Format*/
/*get Hours*/
SUBSTR ((RIGHT (REPEAT ('0',6) || lmtday,6)),1,2) as HH24,
/*get Minutes*/
SUBSTR ((RIGHT (REPEAT ('0',6) || lmtday,6)),3,2) as MM24,
/*get Seconds*/