Skip to content

Instantly share code, notes, and snippets.

View trplll's full-sized avatar

Luke trplll

  • Wisconsin
View GitHub Profile
@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 / 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 / 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*/
@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
//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 / 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 | % {
@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 / 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 / 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 / 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));