Skip to content

Instantly share code, notes, and snippets.

@mkropat
mkropat / autoupdate.bat
Last active March 15, 2019 00:01
Hands-off script to fully patch a fresh Windows install
:: autoupdate.bat - hands-off script to fully patch a fresh Windows install (https://git.io/vzWKw)
::
:: Usage: save this file to %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup and run it
::
:: Derived from a post by EzR (http://serverfault.com/a/732084/55554)
:begin
wuauclt /DetectNow
wuauclt /UpdateNow
@cpoll
cpoll / ANSIColorize.psm1
Last active February 22, 2019 14:42
Powershell helpers for writing ANSI colors (for use with Jenkins ANSI color plugin)
function Write-HostAnsi {
<#
.SYNOPSIS
Wrapper for Write-Host, adds ANSI SGR codes based on -foregroundColor and -backgroundColor
#>
param(
$object,
$foregroundColor,
$backgroundColor
@glennblock
glennblock / Program.cs
Last active November 28, 2015 16:16
CSharp_kvstore
using System;
using System.Threading.Tasks;
using Splunk.Client;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
namespace kvstore
{
class Program
@benhysell
benhysell / WebApiPostWithProgress.cs
Last active May 19, 2025 14:16
c# web api post with progress reporting
//in setup define client and progress reporter
var httpProgressHandler = new ProgressMessageHandler();
httpProgressHandler.InnerHandler = new HttpClientHandler();
var client = new HttpClient(httpProgressHandler) { BaseAddress = new Uri(Settings.Default.ServerUrl) };
//register to use elsewhere in the application, note it is better to resuse for lifetime of application than create for every call
Mvx.RegisterSingleton(client);
Mvx.RegisterSingleton(httpProgressHandler);
@topheman
topheman / git-notes.md
Created June 29, 2015 17:39
Git notes cheat sheet
@bradwilson
bradwilson / append-path.ps1
Last active March 4, 2020 19:09
Add VS 2015 build tools to your path
param(
[Parameter(Mandatory=$true)][string]$pathToBeAdded
)
$local:oldPath = get-content Env:\Path
$local:newPath = $local:oldPath + ";" + $pathToBeAdded
set-content Env:\Path $local:newPath
@altrive
altrive / ToastNotification_Windows10.ps1
Last active May 12, 2024 09:34
Windows 10 toast notification sample
$ErrorActionPreference = "Stop"
$notificationTitle = "Notification: " + [DateTime]::Now.ToShortTimeString()
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
#Convert to .NET type for XML manipuration
$toastXml = [xml] $template.GetXml()
$toastXml.GetElementsByTagName("text").AppendChild($toastXml.CreateTextNode($notificationTitle)) > $null
@altrive
altrive / RemoteFileTransferTest.ps1
Last active November 12, 2019 16:12
PowerShell v5 Remote File Transfer feature usage
#Requires -RunAsAdministrator
#Requires -Version 5.0
$ErrorActionPreference = "Stop"
function Main
{
#Size of dummy file, that transffered by PSRemoting.
$fileSize = 10MB
@philcleveland
philcleveland / linux_setup.sh
Last active October 4, 2015 22:06
LinuxSetup Shell Script
echo ------------------------------------------------------------
echo --- installing curl
echo ------------------------------------------------------------
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup | sudo bash -
echo ------------------------------------------------------------
echo --- installing git
echo ------------------------------------------------------------
sudo apt-get install -y git
@petermorlion
petermorlion / DictionaryJsonConverter
Last active November 12, 2022 16:45
Generic JsonConverter for JSON.NET and IDictionaries
// UPDATE!
// In Json.NET 7, a DictionaryKeyResolver was added.
// This might be able to fix the problem more elegantly.
// I haven't checked though.
public class DictionaryJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var dictionary = (IDictionary)value;