Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeff Wilcox jeffwilcox

View GitHub Profile
@jeffwilcox
jeffwilcox / checkGraph.ts
Created Jun 4, 2021
Quick script to identify users that no longer resolved in the directory
View checkGraph.ts
//
// Copyright (c) Microsoft.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
import throat from 'throat';
import app from '../../../app';
import { IProviders } from '../../../interfaces';
import { ErrorHelper } from '../../../transitional';
@jeffwilcox
jeffwilcox / generate-key-and-token.js
Created Jul 11, 2019
Generating a token in Node.js
View generate-key-and-token.js
// simple JavaScript (Node.js CLI) generating of a key and token
const crypto = require('crypto');
const myKey = crypto.randomBytes(32).toString('base64');
console.log('This is your key. Store is very securely, i.e. KeyVault:');
console.log(myKey);
console.log();
const sha1 = crypto.createHash('sha1');
sha1.update(myKey);
@jeffwilcox
jeffwilcox / gist:2431936
Created Apr 20, 2012
Is a PropertyInfo a static property?
View gist:2431936
public static bool IsStatic(this PropertyInfo propertyInfo)
{
return ((propertyInfo.CanRead && propertyInfo.GetMethod.IsStatic) ||
(propertyInfo.CanWrite && propertyInfo.SetMethod.IsStatic));
}
// So a replacement for getting private and public non-static properties in a type...
public static bool IsStatic(this PropertyInfo propertyInfo)
{
return ((propertyInfo.CanRead && propertyInfo.GetMethod.IsStatic) ||
View sample-digest-data.json
[
{
"submitter": "jwilcox",
"reviewers": ["tim", "nikhil"],
"data": {
"componentName": "react",
"componentVersion": "15.6.1"
}
},
{
@jeffwilcox
jeffwilcox / deploy.cmd
Created Feb 24, 2017
Mail2Bug deployment script for a triggered WebJob deployment
View deploy.cmd
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.7
:: ----------------------
:: Prerequisites
:: -------------
View keybase.md

Keybase proof

I hereby claim:

  • I am jeffwilcox on github.
  • I am jeffwilcox (https://keybase.io/jeffwilcox) on keybase.
  • I have a public key ASBuEKl7kirZR3CekzozA9tkXJY4hr4oL_qrANuKEU5iMAo

To claim this, I am signing this object:

@jeffwilcox
jeffwilcox / setupMongoNode.sh
Last active Dec 18, 2015
Bash script for bringing online a node in a MongoDB cluster powered by Windows Azure IaaS VMs
View setupMongoNode.sh
#!/bin/bash
#
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jeffwilcox
jeffwilcox / updown.js
Created Jun 21, 2013
Simple wrapper over the azure npm module for uploading and downloading blobs
View updown.js
// Simple wrapper over APIs for uploading and downloading blobs from Windows Azure Storage
// by Jeff Wilcox. Apache 2 license, have fun with it.
var azure = require('azure')
, fs = require('fs');
if (process.argv.length < 3) {
console.log('Please call with the proper arguments.');
console.log('node updown.js ACCOUNT KEY CONTAINER up FILENAME');
console.log('node updown.js ACCOUNT KEY CONTAINER down FILENAME');
@jeffwilcox
jeffwilcox / gist:2431507
Created Apr 20, 2012
Reflection comparison
View gist:2431507
// Windows Phone / Standard .NET:
// var mi = dataLoaderType.GetMethod(methodName, paramTypes);
// Windows 8 XAML Metro style app:
var mi = dataLoaderType.GetTypeInfo().GetDeclaredMethods(methodName);
MethodInfo actualMethod = null;
foreach (var method in mi)
{
// Eeeew code.
var parameters = method.GetParameters();
@jeffwilcox
jeffwilcox / gist:2432351
Created Apr 20, 2012
WinRT IsInstanceOfType, IsAssignableFrom
View gist:2432351
/// <summary>
/// Determines whether the specified object is an instance of the current Type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="o">The object to compare with the current type.</param>
/// <returns>true if the current Type is in the inheritance hierarchy of the
/// object represented by o, or if the current Type is an interface that o
/// supports. false if neither of these conditions is the case, or if o is
/// null, or if the current Type is an open generic type (that is,