Skip to content

Instantly share code, notes, and snippets.

View wadewegner's full-sized avatar

Wade Wegner wadewegner

View GitHub Profile
using System.Diagnostics;
using System.Web;
using ikvm.extensions;
using javax.tools;
using NHtmlUnit;
using NHtmlUnit.Html;
using WebClient = NHtmlUnit.WebClient;
using NUnit.Framework;
using Uber;
@wadewegner
wadewegner / killcorrectw3wp.cs
Created January 7, 2015 21:26
Attempt to kill the right w3wp processes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace GetParentProcess
{
class Program
@wadewegner
wadewegner / app.go
Created January 6, 2015 04:07
Trying out the gorilla/pat request router and dispatcher package for Go.
package main
import (
"github.com/gorilla/pat"
"net/http"
)
func main() {
r := pat.New()
@wadewegner
wadewegner / Web.Config
Last active August 29, 2015 14:12
Files for post "Running Go in Azure Websites in 4 Simple Steps"
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="d:\home\site\wwwroot\go\bin\go.exe"
arguments="run d:\home\site\wwwroot\server.go"
startupTimeLimit="60">
<environmentVariables>
@wadewegner
wadewegner / ExternalLoginConfirmation.cs
Last active August 29, 2015 14:06
Trying to get salesforce auth with OWIN working
//
// POST: /Account/ExternalLoginConfirmation
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
{
if (User.Identity.IsAuthenticated)
{
return RedirectToAction("Manage");
<?xml version="1.0" encoding="utf-16"?>
<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:siena="http://schemas.microsoft.com/MicrosoftProjectSiena/WADL/2014/11" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sienatool="http://www.todo.com"
siena:serviceId="WadeAPIServiceWadl">
<grammars>
<jsonTypes targetNamespace="http://www.todo.com" xmlns="http://schemas.microsoft.com/MicrosoftProjectSiena/WADL/2014/11">
<object name="GetAccounts_Root">
<property name="totalSize" type="number" />
<property name="done" type="boolean" />
<property name="records" typeRef="GetAccounts_records_Array" />
</object>
@wadewegner
wadewegner / TokenValidationHandler.cs
Last active August 29, 2015 14:05
TokenValidationHandler
public class TokenValidationHandler : DelegatingHandler
{
private readonly string _storageConnectionString = CloudConfigurationManager.GetSetting("StorageConnectionString");
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
const string errorMessage = "Unauthorized access; {0}";
const HttpStatusCode code = HttpStatusCode.Unauthorized;
var authValue = request.Headers.Authorization;
import os
import psycopg2
import urlparse
import pika, logging
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
logging.basicConfig()
import os
import psycopg2
import urlparse
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(
database=url.path[1:],
user=url.username,
@wadewegner
wadewegner / upload_rest.py
Last active August 9, 2024 16:01
Upload attachment to Salesforce using Python
import requests
import base64
import json
from simple_salesforce import Salesforce
userName = ''
password = ''
securityToken = ''
instance = ''