Skip to content

Instantly share code, notes, and snippets.

@bobbychopra
bobbychopra / AddColumn.ps1
Created October 9, 2012 21:28
Add Date column to an existing csv file
$today = [System.DateTime]::Today.ToString("yyyyMMdd")
Import-Csv -Header Column1,Column2 -Delim ',' 'C:\sample.csv' |
ForEach {
New-Object psobject -Property @{Date=$today;Col1=$_.Column1; Col2=$_.Column2}
} | Select-Object Date,Col1,Col2 | Export-Csv -NoTypeInformation 'C:\sample.csv'
@bobbychopra
bobbychopra / DelegateCommand.cs
Created June 8, 2012 12:59
WPF Delegate Command
using System;
using System.Windows.Input;
namespace MyNameSpace
{
/// <summary>
/// DelegateCommand borrowed from
/// http://www.wpftutorial.net/DelegateCommand.html
/// </summary>
public class DelegateCommand : ICommand
@bobbychopra
bobbychopra / App.xaml.cs
Created June 8, 2012 17:42
Log4Net Configuration in WPF
using System.Windows;
using log4net;
namespace Namespace
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
@bobbychopra
bobbychopra / git-export
Created September 21, 2017 18:39 — forked from kristofferh/git-export
"Export" a git repository to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
@bobbychopra
bobbychopra / mailmergeppt.vba
Created July 12, 2013 20:18
Mail Merge for Powerpoint
Sub MailMergeFromFile()
Dim hf As Integer: hf = FreeFile
Dim lines() As String, i As Long
Open "c:\users.txt" For Input As #hf
lines = Split(Input$(LOF(hf), #hf), vbNewLine)
Close #hf
For i = 0 To UBound(lines)
' MsgBox "Line" & i & "=" & lines(i)
@bobbychopra
bobbychopra / object.sql
Created July 12, 2013 20:10
Find object in SQL Server
SELECT * FROM sys.objects WHERE name like '%tbl%'
@bobbychopra
bobbychopra / DynamicCsvReader.cs
Created April 25, 2013 11:01
Dynamic Reading Simple Csv
using System;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.IO;
using System.Threading.Tasks;
namespace TestTPL
{
@bobbychopra
bobbychopra / DateTimeExt.cs
Last active December 16, 2015 13:59
Frequently Used Extension Methods
namespace System
{
public static class DateTimeExt
{
public static DateTime ToUnspecified(this DateTime dt)
{
return DateTime.SpecifyKind(dt, DateTimeKind.Unspecified);
}
}
}
void Main()
{
Console.WriteLine(GetCode("A"));
Console.WriteLine(GetCode("Z"));
Console.WriteLine(GetCode("AA"));
Console.WriteLine(GetCode("AZ"));
Console.WriteLine(GetCode("AAA"));
}
// Define other methods and classes here