Skip to content

Instantly share code, notes, and snippets.

View dannylloyd's full-sized avatar

Danny Lloyd dannylloyd

  • University of Arkansas for Medical Sciences
  • Cabot, Arkansas
View GitHub Profile
@dannylloyd
dannylloyd / GetLoggedInUsers.ps1
Created June 10, 2020 20:53
Gets all users logged into a machine
query user /server:computername
@dannylloyd
dannylloyd / Write to Excel using EPPLUS.cs
Created May 6, 2019 15:26
Write to Excel using EPPLUS
using (var pck = new OfficeOpenXml.ExcelPackage())
{
var ws = pck.Workbook.Worksheets.Add("Sheet1");
ws.Cells.LoadFromCollection(mrns);
pck.SaveAs(new FileInfo(@"C:\Temp\Output.xlsx"));
}
@dannylloyd
dannylloyd / Read from Excel.cs
Last active December 8, 2020 20:29
Read data from Excel file using EPPLUS
var path = @"C:\Temp\Path-To-File.xlsx";
using (var pck = new OfficeOpenXml.ExcelPackage())
{
using (var stream = File.OpenRead(path))
{
pck.Load(stream);
}
var ws = pck.Workbook.Worksheets.First();
for (int rowNum = 1; rowNum <= ws.Dimension.End.Row; rowNum++)

PowerShell GUID Generator

From time to time, I need to generate GUID to be used as Unique Id for whatever reason. When I have Visual Studio opened, I usually use the GUID tool that comes with it.

But sometimes I am developing in VS Code and opening Visual Studio just to get access to the GUID tool is a pain.

So why not add the functionality to PowerShell instead? You can have PowerShell available from inside VS Code Terminal. It's the perfect thing to add.

So how do we go about that?

@dannylloyd
dannylloyd / ComputerName.bat
Created April 24, 2015 15:29
Get Compuer name from IP address
PING -A xxx.xxx.xxx.xxx
@dannylloyd
dannylloyd / SQL Table to CSharp.sql
Last active September 30, 2021 19:14
SQL Table to VB Class (SQL 2000)
declare @TableName sysname;
set @TableName = 'TABLENAME';
declare @Namespace varchar(50);
set @Namespace = 'NAMESPACE';
declare @prop varchar(8000);
DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10)
PRINT 'using System; '
PRINT 'using NPoco; '
PRINT ''
PRINT 'namespace ' + @Namespace + ' {'
@fushnisoft
fushnisoft / fileupload.ps1
Last active January 19, 2022 08:03
Upload a file using powershell and the WinSCP .NET library with upload progress feedback
# Using the beta version of WinSCP http://winscp.net/eng/download.php
# Call this script to upload a file via FTP with progress feedback
# e.g.
# .\fileupload.ps1 -username "myusername" -password "mypassword" -localfile "C:\files\MyFile.exe" -remotefile "/public_html/files/MyFile.exe"
# NOTE: This script assumes the WinSCP binaries are in a sub directory to the script. You can probably pass that as a parameter to be more flexible.
param (
[string]$username,
[string]$password,
[string]$localFile,
@aroberts
aroberts / git-multi-status.sh
Created June 29, 2012 13:58 — forked from jcordasc/rec_git_status.sh
Script for checking git status of many git repositories
#!/bin/bash
# usage: $0 source_dir [source_dir] ...
# where source_dir args are directories containing git repositories
red="\033[00;31m"
green="\033[00;32m"
yellow="\033[00;33m"
blue="\033[00;34m"
purple="\033[00;35m"
@dannylloyd
dannylloyd / Output.vb
Created March 30, 2012 14:59
Write file to output stream
Context.Response.ContentType = "application/pdf; name=" & filename
Context.Response.AddHeader("content-disposition", "inline; filename=" & filename)
Context.Response.AddHeader("content-length", pdfBytes.Length.ToString())
Context.Response.BinaryWrite(pdfBytes)
Context.Response.End()
@dannylloyd
dannylloyd / Check All Checkboxes.js
Last active September 27, 2015 11:18
Selects all checkboxes in a asp.net gridview
var gridView = '#<%= gridViewId.ClientID%>';
var checkAll = '#checkBoxId';
$(checkAll).click(function (i, v) {
$('input[type=checkbox]', gridView).prop('checked', this.checked);
});
var checkCount = $('input[type=checkbox]', gridView).length;
$('input[type=checkbox]', gridView).click(function (i, v) {
$(checkAll).prop('checked', $('input:checked', gridView).length == checkCount);