Skip to content

Instantly share code, notes, and snippets.

@robertchong
robertchong / LocateExpiredCACerts.ps1
Last active August 26, 2016 12:17
Locate Expired CA Certificates on Your Windows Machine
#
# LocateExpiredCACerts
# Source: http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/17/3386232.aspx
#
$store=new-object System.Security.Cryptography.X509Certificates.X509Store("\\<COMPUTER_NAME>\CA","LocalMachine")
$store.open("ReadOnly")
$store.certificates | % {
@robertchong
robertchong / CallForwarding.java
Last active June 5, 2024 01:54
Android programming - Call forwarding
package com.danielthat.callforwarding;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.view.View;
import android.widget.Button;
import android.app.Activity;
import android.content.Context;
#!/bin/bash
# Henrik Austad ,2009
# UNINETT Sigma A/S
#
# make_cmc.sh
#
# Shell-wrapper for making CMC's to send to a dogtag system
# This script uses CMCEnroll to create CMCs, and it creates simple CMCs,
# i.e. no bundling of several CSRs together.
#
@robertchong
robertchong / awk_groupby_count_total_avg.sh
Created April 19, 2014 13:24
GROUP BY clause functionality in awk - bash
#!/bin/bash
#
# This shell script demonstrates how to implement group by & aggregate functions in awk
# See http://www.unixcl.com/2008/09/group-by-clause-functionality-in-awk.html
#
# Input: A colon (:) delimited file tabulating Continents and numbers
# Output: Continents and values returned by aggregate functions Count(*), Total, Average
#
if [ $# -ne 1 ]; then
@robertchong
robertchong / CSVUtils.java
Created April 19, 2014 02:59
Convert Excel to CSV
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
@robertchong
robertchong / DataConvertionUtil.java
Created April 19, 2014 02:25
Excel <-> CSV Conversion using Apache POI
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
@robertchong
robertchong / CertificateChainValidator.java
Created April 19, 2014 01:54
Certificate Chain Validator
/*
* See http://www.netmite.com/android/mydroid/1.6/frameworks/base/core/java/android/net/http/CertificateChainValidator.java
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@robertchong
robertchong / DelimitedToXls.java
Created April 19, 2014 01:03
Convert Delimited text or .csv to Excel using Apache POI
package com.hi.hiqww.jfxclient.export;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {