Skip to content

Instantly share code, notes, and snippets.

View trplll's full-sized avatar

Luke trplll

  • Wisconsin
View GitHub Profile
@trplll
trplll / ClearDisableProxy.vbs
Last active December 13, 2016 16:07
VB script to clear and disable system proxy by editing the registry settings
Option Explicit
Dim objShell, RegLocate, RegLocate1
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
objShell.RegWrite RegLocate,"","REG_SZ"
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
objShell.RegWrite RegLocate,"0","REG_DWORD"
WScript.Quit
@trplll
trplll / .htaccess
Created December 2, 2016 13:55
Apache .htaccess redirect configurations
#Forces any http request to be rewritten using https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#also forces directly linked resources (images, css, etc.) to use https
#RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@trplll
trplll / mapping_AS400.xml
Last active December 13, 2016 16:05
Ease the pain of importing table schemas into Talend. Change DB type "NUMERIC" mapping to have a default talend type of "id_Integer" instead of Float
<?xml version="1.0"?>
<mapping>
<dbms product="AS400" id="as400_id" label="Mapping AS400"
default="true">
<dbTypes>
<dbType type="BIT" ignoreLen="true" ignorePre="true" />
<dbType type="CHAR" defaultLength="1" ignoreLen="false" ignorePre="true" />
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10" ignoreLen="false" ignorePre="false"/>
<dbType type="DOUBLE" ignoreLen="true" ignorePre="true" />
@trplll
trplll / shipmentwoload.sql
Created November 22, 2016 15:01
Shipments without load basic query
SELECT sddoco,sdlnid,sdmcu,sdshan,RSSHPN, RSLDNM, RSPPDJ FROM F4211
join F4941 on sdshpn=rsshpn
WHERE SDNXTR>=535
AND SDNXTR<=550
AND SDPPDJ>=115326
and RSLDNM=0
AND RSPPDJ>115326
and sdmcu in (' 20')
and sdshan in (' 22',' 24',' 25',' 27',' 28')
@trplll
trplll / gist:8f11f6ace40d113ac58255b7398084ce
Created November 7, 2016 15:15
JDE Type Param List csv
package com.company;
public class Main{
public static void main (String[] args){
System.out.println("Tal job can convert csv Params to data selection in SQL and Talend components:\n");
System.out.println("Context Var MCUS:\n In URL/BAT:\n --context_param MCUS= 20 , 23, 301 , 21\n In Talend:\n context.MCUS = " +MCUcsvStringtoSQLStringList("20 , 23, 301 , 21"));
System.out.println("\nContext Var DCTOS:");
System.out.println(" In URL/BAT:\n --context_param DCTOS= SO, OP, ST\n In Talend:\n context.DCTOS = " +DCTcsvStringtoSQLStringList(" SO, OP, ST"));
@trplll
trplll / TryWithResources.java
Created October 18, 2016 18:33
Try vs try with resources
package com.trplcd.jdbc;
import java.sql.Connection;
import java.sql.SQLException;
/**
* Created by ace01359 on 10/10/2016.
*/
public class TestSqlCon {
@trplll
trplll / jdbc_DBType.java
Created October 11, 2016 15:26
Basic JDBC connection Utility for multiple databases
package com.trplcd.jdbc;
/**
* Created by ace01359 on 10/10/2016.
*/
public enum DBType{
AS400, MYSQLDB
}
@trplll
trplll / company_Main.java
Created September 18, 2016 20:57
Using xml property files for java program
package com.company;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
@trplll
trplll / Main.java
Created September 18, 2016 20:54
Simple command line file read with buffer reader
package com.company;
import java.io.BufferedReader;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) {
if(args.length == 0) {
@trplll
trplll / FileAndDirCreateModify.java
Last active September 18, 2016 20:52
Using Java.nio.file , java.io , and java util to create and modify directories, zip directories , and files in the file system
package com.jwhh;
import java.io.BufferedWriter;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;