Skip to content

Instantly share code, notes, and snippets.

View rgregg's full-sized avatar

Ryan Gregg rgregg

  • Microsoft
  • Seattle, WA
View GitHub Profile
@rgregg
rgregg / update-version.sh
Created August 3, 2021 05:17
Update Minecraft FTB/ATM6 docker containers to the latest version
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied. Must specify the version for the upgrade."
exit 1
fi
new_version=$1
#!/bin/bash
# Changes exmaple.com to use nip, which is DNS magic for any IP address
export EXTERNAL_IP=$(kubectl get svc istio-ingressgateway -n istio-system -o jsonpath='{.status.loadBalancer.ingress.*.ip}')
kubectl patch cm config-domain -n knative-serving -p "{\"data\": { \"${EXTERNAL_IP}.nip.io\": \"\" }}"
@rgregg
rgregg / extract-license.md
Created July 19, 2018 19:16
How to extract LICENSES from docker image
  1. Start the container

    $ docker run -d {docker image}
    f05ad96e2570da12c27784d0d4752c99269e25713bb8565c287eb52d8f97573f
  2. Extract the license from the container to standard out

@rgregg
rgregg / notification-body.json
Last active February 25, 2022 23:17
Webhook notification body template for AppVeyor to Microsoft Teams
{
{{#passed}}
"title": "Build {{projectName}} {{buildVersion}} completed",
"themeColor": "5FE35F",
{{/passed}}
{{#failed}}
"title": "Build {{projectName}} {{buildVersion}} failed",
"themeColor": "FC5C3C",
{{/failed}}
"text": "Commit [{{commitId}}](https://github.com/{{repositoryName}}/commit/{{commitId}}) by {{committerName}} on {{commitDate}}: {{commitMessage}}",
@rgregg
rgregg / QuickXorHash.cs
Last active October 12, 2023 11:54
Old: Sample code to generate the OneDrive Quick XOR Hash value for a file. The official documentation for the QuickXorHash is available here: https://learn.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash?view=odsp-graph-online
// ------------------------------------------------------------------------------
// Copyright (c) 2016 Microsoft Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@rgregg
rgregg / Program.cs
Created June 23, 2015 05:55
OneDrive View.Changes Experiment Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
using System.IO;
// Requires Newtonsoft.Json and Nito.AsyncEx NuGet Packages
@rgregg
rgregg / OneDriveError.cs
Created June 19, 2015 20:39
OneDrive Error Code Handling
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Microsoft.OneDrive
{
public class OneDriveError
@rgregg
rgregg / MsaForStoreApps.cs
Last active February 25, 2022 23:19
Windows Store App Sign-in for OneDrive SDK
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Windows.Security.Authentication.OnlineId;
namespace OneDrive
{
public class MsaForStoreApps
{
@rgregg
rgregg / FancyConsole.cs
Last active February 25, 2022 23:19
FancyConsole
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
public class FancyConsole
{
private static string _logFileName;
@rgregg
rgregg / onedrive-bits-upload.md
Last active May 26, 2022 09:17
OneDrive Large File Upload API

Uploading Large Files

NOTICE: The OneDrive API now has native supported for large file uploads. Instead of using BITS, consider using the OneDrive API upload method instead!

Note This is preliminary documentation and is subject to change as we evolve the OneDrive API.

OneDrive handles uploading large files by supporting the BITS protocol.