Skip to content

Instantly share code, notes, and snippets.

View johnweldon's full-sized avatar

John Weldon johnweldon

View GitHub Profile
@johnweldon
johnweldon / read_xlsx.cs
Created October 9, 2012 20:44
Read Excel .xlsx file and return first worksheet as a DataTable
using System.Data;
using System.Data.OleDb;
using System.Diagnostics;
namespace JW4.DB.Util
{
public static class Excel
{
public static DataTable GetFirstWorksheetAsTable(string filename)
{
DROP TABLE tempA; CREATE TABLE tempA ( style_cd CHAR(3), id_cd VARCHAR(15) );
DROP TABLE tempB; CREATE TABLE tempB ( item_desc VARCHAR(50), item_num CHAR(4), style_cd CHAR(3), id_cd VARCHAR(15) );
INSERT INTO tempA
SELECT 'A', 123456
UNION SELECT 'A', 654321
UNION SELECT 'B', 321456
UNION SELECT 'A', 654123
UNION SELECT 'C', 424242;
@johnweldon
johnweldon / start-sshagent
Created December 20, 2011 00:43
powershell script to start the ssh-agent
$ gcm start-sshagent | fl
Name : start-sshagent
CommandType : Function
Definition :
if($env:SSH_AGENT_PID) { echo "ssh-agent running"; return }
$private:gp = get-gitbinpath
if($private:gp) {
$private:out = & (join-path $private:gp "ssh-agent")