Skip to content

Instantly share code, notes, and snippets.

View rseroter's full-sized avatar

Richard Seroter rseroter

View GitHub Profile
@rseroter
rseroter / function.go
Created March 1, 2022 17:26
Go service that reads Google Cloud Storage objects
package goportable
import (
"encoding/json" //encoding the response
"log" //writing logs
"net/http"
"strings" //flattening an array
"cloud.google.com/go/storage" //talking to cloud storage
"github.com/GoogleCloudPlatform/functions-framework-go/functions" //go middleware
@rseroter
rseroter / web.config
Created April 16, 2018 16:36
Generated web.config when pushing Node Express 4 app to Azure App Service
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
@rseroter
rseroter / gist:4040128
Created November 8, 2012 17:10
Example web.config for Iron Foundry app using Windows Azure Access Control Service
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
@rseroter
rseroter / gist:3429452
Created August 22, 2012 21:14
Example code #2 for using Iron Foundry application service (Microsoft Service Bus)
public static void SendMessage(string message)
{
var msg = new BrokeredMessage(message);
MessagingFactory factory = Nested.instance.messagingFactory;
MessageSender msgSender = factory.CreateMessageSender(QueueName);
msgSender.Send(msg);
}
public static IEnumerable<string> ReceiveMessages(ushort messageCount)
{
@rseroter
rseroter / gist:3429427
Created August 22, 2012 21:10
Example code for using Iron Foundry application service (Microsoft Service Bus)
public QueuingManager()
{
var jss = new JavaScriptSerializer();
dynamic data = jss.Deserialize<dynamic>(WebConfigurationManager.AppSettings["VCAP_SERVICES"]);
//set values
string sb_oauth = data["mssb-1.0"]["credentials"]["sb_oauth"]; // 4446
string sb_runtime_address = data["mssb-1.0"]["credentials"]["sb_runtime_address"]; // 9354
string userName = data["mssb-1.0"]["credentials"]["username"];
@rseroter
rseroter / AzureNodeSdkError
Created August 8, 2012 00:22
Error thrown by Node.js app that uses Azure SDK
/var/vcap.local/dea/apps/seroternode-0-6ac0e0e5c05575d5809e2138fc145d39/app/node_modules/azure/lib/services/serviceManagement/models/roleschema.json:2
"RoleName":
^
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token :
at Module._compile (module.js:406:25)
at Object..js (module.js:417:10)