Skip to content

Instantly share code, notes, and snippets.

View jrolstad's full-sized avatar

Josh Rolstad jrolstad

View GitHub Profile
@jrolstad
jrolstad / dev-machine-setup.ps1
Last active June 14, 2018 22:49
Dev Machine Setup Script in Powershell
# Install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Install Git
choco install git -y
choco install tortoisegit -y
if (($env:Path.Split(';') -contains "C:\Program Files\Git\bin") -eq $false) {
$env:Path += ";C:\Program Files\Git\bin";
[System.Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine );
@jrolstad
jrolstad / Program.cs
Created March 31, 2016 21:24
Simple application to monitor if the system path variable exceeds 2048 characters. If it does, then an alert will be shown.
using System;
using System.Windows.Forms;
using environment_monitor.Properties;
namespace environment_monitor
{
static class Program
{
/// <summary>
/// The main entry point for the application.
@jrolstad
jrolstad / PathVariableTests.cs
Last active March 31, 2016 16:14
Sometimes the Windows Path variable exceeds 2048 characters, which can lead to errors in many applications and the Windows OS itself. This is a series of tests to check this and possibly fix.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
namespace PathTests
{
[TestFixture]
public class PathVariableTests
@jrolstad
jrolstad / Update-Packages.ps1
Created October 22, 2015 14:28
Powershell script that reinstalls Nuget Packages in the Visual Studio Package Manager Console. Useful when a project's framework version is upgraded
$projectName = "<project name>"
Get-Package -projectName $projectName | ForEach-Object {UnInstall-Package -Id $_.Id -projectName $projectName -Force;Install-Package -Id $_.Id -Version $_.Version -IgnoreDependencies -projectName $projectName}
@jrolstad
jrolstad / gist:282880f4ddbdac210284
Created October 5, 2015 21:57
Search Github Organization Branches
class Program
{
static void Main(string[] args)
{
var userName = "<user name>";
var password = "<password>";
var organization = "<user name or Organization Name";
var filter = "<what I'm looking for>";
Console.WriteLine("Querying Github...");
@jrolstad
jrolstad / gist:e9fc5da79ea401522016
Created March 6, 2015 18:31
How to convert to Local Time
[Test]
[TestCase("America/Los_Angeles")]
[TestCase("Australia/Sydney")]
public void ShowLocalTimes(string timezone)
{
var someDate = DateTime.Now.ToUniversalTime();
var instant = Instant.FromDateTimeUtc(someDate);
var timeZone = DateTimeZoneProviders.Tzdb.GetZoneOrNull(timezone);
var localTime = instant.InZone(timeZone);
@jrolstad
jrolstad / gist:5ca7d78dbfe182d7c1be
Last active December 16, 2023 06:55
List all NodaTime Timezones
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NodaTime.TimeZones;
using NUnit.Framework;
namespace what_time_is_it
{