Skip to content

Instantly share code, notes, and snippets.

View wadewegner's full-sized avatar

Wade Wegner wadewegner

View GitHub Profile
@wadewegner
wadewegner / addselftosqlsysadmin.cmd
Created January 25, 2012 18:35
Script to add the current user to the sysadmin role in SQL Server
@echo off
rem
rem ****************************************************************************
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.
rem This code is licensed under the Microsoft Public License.
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
@wadewegner
wadewegner / gist:3404785
Created August 20, 2012 14:40
Create a base 64 encoded sequence of 256 bits
byte[] b = new byte[32];
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
randomNumberGenerator.GetBytes(b);
string result = Convert.ToBase64String(b);
[TestMethod]
public void PublicFeedIsNotNull()
{
PublicFeedRootObject result = null;
var mre = new ManualResetEvent(false);
untapped = new UntappdService();
untapped.PublicFeed(publicFeed =>
{
Service cannot be started. System.IO.FileLoadException: Mixed mode assembly is built against version
'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration
information.
at Microsoft.MediaCenter.Store.ObjectStore.Open(String fileName, String providerName, String password, Assembly callingAssembly, Boolean isCollecting)
at Microsoft.MediaCenter.Store.ObjectStore.Open(String fileName, String providerName, String password, Boolean isAdminRequested)
at Microsoft.MediaCenter.Store.ObjectStore.AddObjectStoreReference()
at Microsoft.MediaCenter.Store.ObjectStore.get_DefaultSingleton()
at Microsoft.MediaCenter.TV.Scheduling.Internal.EventScheduleHandler..ctor(RecordingChangeEventHandler recordingChangeHandler, RequestedProgramChangeEventHandler requestedProgramChangeHandler)
at Microsoft.MediaCenter.TV.Scheduling.EventSchedule..ctor()
at Microsoft.HomeServer.Archive.TransferService.ScheduleMonitor.Start()
@wadewegner
wadewegner / gist:3849535
Created October 7, 2012 20:43
This is a short test that will ensure that controller dependencies are bound appropriately for Ninject. For this to work, you either have to make the bootstrapper public or mark it internal and add the InternalsVisibleTo attribute to the assembly.
[Test]
public void ensure_controller_dependencies_are_bound()
{
var assemblyName = "MvcApplication4";
var assembly = Assembly.Load(assemblyName);
var parameters = (from type in assembly.GetTypes().Where(
t => t.IsAbstract == false && typeof (Controller).IsAssignableFrom(t))
from constructor in type.GetConstructors()
from parameter in constructor.GetParameters()
@wadewegner
wadewegner / gist:4047128
Created November 9, 2012 17:50
Call Parse Cloud Code from WinRT
var parameters = new Dictionary<string, object> { { "message", "Hello!" } };
await ParseCloud.CallFunctionAsync<IDictionary<string, object>>("sendsms", parameters);
@wadewegner
wadewegner / WAIIASWebFarm1
Created March 4, 2013 05:42
PowerShell scripts supporting post "Using Windows Azure Virtual Machines to Publish and Synchronize a Web Farm" found here: http://www.wadewegner.com/2013/03/using-windows-azure-virtual-machines-to-publish-and-synchronize-a-web-farm/
$imgname = 'WS2012-WebFarmImage'
$cloudsvc = 'DemoWebFarm'
$pass = 'Password'
$subscriptionName = 'Windows Azure MSDN - Visual Studio Ultimate'
$storageAccount = 'portalvhds9dvbvvff5hdg3'
$location = 'East US'
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccount
$iisvm1 = New-AzureVMConfig -Name 'iis1' -InstanceSize Small -ImageName $imgname |
@wadewegner
wadewegner / QueryBuilder.reg
Created October 21, 2013 18:02
Enable Query Builder in Outlook 2013
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\QueryBuilder]
@wadewegner
wadewegner / gettoken_local.py
Last active February 24, 2023 00:39
Simple Python scripts for making a token request against the Force.com REST APIs. The first does not include the security token and the second does. You will want to use the second one.
import requests
consumer_key = "YOUR_CONSUMER_KEY"
consumer_secret = "YOUR_CUSTOMER_SECRET"
username = "YOUR_USER_NAME"
password = "YOUR_PASSWORD"
payload = {
'grant_type': 'password',
'client_id': consumer_key,
@wadewegner
wadewegner / gettoken.lua
Last active December 28, 2015 22:18
Simple Lua script for making a token request against the Force.com REST APIs.
local secretKey = "YOUR_SECRET_KEY"
local data = {
client_id = "YOUR_CONSUMER_KEY",
client_secret = "YOUR_CONSUMER_SECRET",
grant_type = "password",
username = "YOUR_LOGIN",
password = "YOUR_PASSWORD" .. secretKey
}