Skip to content

Instantly share code, notes, and snippets.

View p4535992's full-sized avatar
๐Ÿ™„
I may be slow to respond.

4535992 p4535992

๐Ÿ™„
I may be slow to respond.
View GitHub Profile
@p4535992
p4535992 / ngrok-with-IISExpress.md
Created February 16, 2017 09:04 — forked from nsbingham/ngrok-with-IISExpress.md
How to get ngrok working with IISExpress/Visual Studio 2013
  1. Decide on a subdomain to use with ngrok. This makes the whole process easier.
  2. Open up a Command Prompt in Administrator mode and run the following command to register the URL with HTTP.sys replacing "modernie" with your subdomain and ##### with your VisualStudio/IISExpress application's port.
netsh add urlacl url=http://modernie.ngrok.com:##### user=everyone
  1. Edit your applicationhost.config. The easiest way to is start up the site and right-click the IISExpress icon in the System Tray. Click "Show All Applications" and select your website running at localhost:#####. Click the path next to "Config" to open the file in an editor.
  2. Search for you site's <bindings> configuration. The easiest way is to search for *:#####:localhost, which should bring you to the <bindings> section for your site. Edit them to include the following:
@p4535992
p4535992 / PlacesRESTController.java
Created April 14, 2017 07:17 — forked from wvuong/PlacesRESTController.java
Simple generic REST-ful Spring MVC controller, interops with Spring Data repositories
package com.willvuong.foodie.controller;
import com.willvuong.foodie.dao.PlaceRepository;
import com.willvuong.foodie.domain.Place;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@p4535992
p4535992 / GroupingGridWithCustomSort.java
Created June 19, 2017 16:19 — forked from branflake2267/GroupingGridWithCustomSort.java
GXT Grid GroupingView with Custom Sort using local compartor
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.Editor.Path;
@p4535992
p4535992 / AuthenticationTokenInjectHandler.java
Created June 29, 2017 10:31 — forked from sivaprasadreddy/AuthenticationTokenInjectHandler.java
JAX-WS WSI Authentication using UserName & Password Security Headers
import java.io.IOException;
import java.util.Set;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPHeader;
@p4535992
p4535992 / customselectone.ftl
Created August 9, 2017 09:29 — forked from softwareloop/customselectone.ftl
alfresco-picklist-fields-in-detail
<#include "/org/alfresco/components/form/controls/common/utils.inc.ftl" />
<#if field.control.params.optionSeparator??>
<#assign optionSeparator=field.control.params.optionSeparator>
<#else>
<#assign optionSeparator=",">
</#if>
<#if field.control.params.labelSeparator??>
<#assign labelSeparator=field.control.params.labelSeparator>
<#else>
@p4535992
p4535992 / gist:f9ea1a8d47af5a4e404c6472fc6e0d96
Created August 29, 2017 17:52 — forked from djangofan/gist:2493145
Using etc alternatives to set default Java on CentOS
[user@www]# alternatives --install /usr/bin/java java /opt/jdk1.6.0_07/bin/java 2
[user@www]# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jdk1.6.0_07/bin/java
@p4535992
p4535992 / resetDashboard.js
Created December 13, 2017 10:43 — forked from loftux/resetDashboard.js
Script to reset user dashboard in Alfresco. Actually two scripts in same Gist. To be used with the Alfresco Javascript console//
//***** Script variant one, fore one user ********
var userid = "userid01";
var searchobj = {
query:'PATH:"/app:company_home/st:sites/cm:surf-config/cm:components/*" AND @cm\:name:"*'+userid+'*"',
language: 'fts-alfresco'
};
var nodes = search.query(searchobj);
@p4535992
p4535992 / ManageHashPdfBox
Created February 2, 2018 15:35
A static method for extract hash/digest from a pdfbox document object to sign and the static method to "insert" the new hash/digest signed to the pdf box object
public static byte[] createHashToSignFromPdfFile(InputStream pdf2sign, OutputStream fos, String sigName, String sigLocation,String sigReason,String contactInfo,Date forcedDate,Long revisionId) throws IOException {
File pdfFileToSigned = TempFileProvider.createTempFile("chars", ""+Calendar.getInstance().getTimeInMillis());
File pdfPreparedToBeSigned = TempFileProvider.createTempFile("chars", ""+Calendar.getInstance().getTimeInMillis());
File pdfHashPreparedToBeSigned = TempFileProvider.createTempFile("chars", ""+Calendar.getInstance().getTimeInMillis());
try{
if(fos == null) fos = new FileOutputStream(pdfPreparedToBeSigned);
FileUtils.copyInputStreamToFile(pdf2sign,pdfFileToSigned);
final byte[] signatureBytes = FileUtils.readFileToByteArray(pdfFileToSigned);
@p4535992
p4535992 / SecureLoggingUtil.java
Created September 4, 2018 07:18 — forked from sachin-handiekar/SecureLoggingUtil.java
Masking Sensitive Information in CXF Logging Interceptor for incoming/outgoing SOAP request. (http://www.sachinhandiekar.com/2014/11/cxf-logging-interceptor-masking.html)
package com.sachinhandiekar.examples.cxf.logging;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;