Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Rolstad jrolstad

View GitHub Profile
@jrolstad
jrolstad / dev-machine-setup.ps1
Last active Jun 14, 2018
Dev Machine Setup Script in Powershell
View dev-machine-setup.ps1
# 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 Mar 31, 2016
Simple application to monitor if the system path variable exceeds 2048 characters. If it does, then an alert will be shown.
View Program.cs
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 Mar 31, 2016
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.
View PathVariableTests.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
namespace PathTests
{
[TestFixture]
public class PathVariableTests
View Half Marathon Notes.md
@jrolstad
jrolstad / Update-Packages.ps1
Created Oct 22, 2015
Powershell script that reinstalls Nuget Packages in the Visual Studio Package Manager Console. Useful when a project's framework version is upgraded
View Update-Packages.ps1
$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 Oct 5, 2015
Search Github Organization Branches
View gist:282880f4ddbdac210284
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 Mar 6, 2015
How to convert to Local Time
View gist:e9fc5da79ea401522016
[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 Sep 9, 2021
List all NodaTime Timezones
View gist:5ca7d78dbfe182d7c1be
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
{