Skip to content

Instantly share code, notes, and snippets.

View spboyer's full-sized avatar
💭
Coding, contributing, supporting, mentoring, learning, all of the right verbs

Shayne Boyer spboyer

💭
Coding, contributing, supporting, mentoring, learning, all of the right verbs
View GitHub Profile
@spboyer
spboyer / vscodeforthewebazure.txt
Created November 11, 2024 18:07
VS Code for the Web - Azure
o [Music] hello hello everyone welcome to the vs code live stream if you are new here my name is Olivia I am a developer Advocate on the vs code team um and I'm so happy to be here with you all um the live streams are a great chance for us to bring guests on Spotlight different features different things that use vs code um we have a really great lineup today that we're going to be talking about some great guests um but before we dive into that let me know where you're watching from in the chat um if you haven't been
in these before we really like to make this an interactive experience um so as we go through the demo today talking about the product we'll be showing off um definitely let us know your questions we'll be monitoring the chat for that um and asking our guests as we go so it's a great chance for you to be able to talk firsthand with the people people who work on the product you love hello abriel Hi how are you doing thanks so much for joining um definitely drop in the
@spboyer
spboyer / gen.bicep
Created August 22, 2022 18:15
Bicep File Generated by Bicep Extension - .NET API
@description('Generated from /subscriptions/<mysubid>/resourceGroups/dotnetazdsample-rg/providers/Microsoft.Web/sites/app-api-us4wfunnnezqy')
resource appapiuswfunnnezqy 'Microsoft.Web/sites@2022-03-01' = {
name: 'app-api-us4wfunnnezqy'
kind: 'app'
location: 'South Central US'
tags: {
'azd-env-name': 'dotnetazdsample'
'azd-service-name': 'api'
}
@spboyer
spboyer / dotnetcore_docker_k8s.md
Last active November 9, 2019 14:55
.NET Core Microservices, Docker, Kubernetes demo script

Simplest Microservice

File > New Project > Empty Web

  • This shows the minimal microservices that .NET Core offers, receiving a request, returning a route.
  • We have found that when talking to customers that they were building APIs having MVC was more than needed. The "V" was unused, the folder structure may have not made sense etc.
  • Talk to Endpoint Routing
  • Add Health Check - speak to the built in capabilities if Docker and K8s looking for a health endpoint and acting on fail/success
@spboyer
spboyer / dotnetconf.md
Created September 23, 2019 16:55
dotnetconf script
dotnet new worker -o worker
cd worker
code-insiders .
  • Add Dockerfile
az acr build -t workersidecar1:latest -r shayne .
@spboyer
spboyer / Program.cs
Created June 7, 2019 20:27
Basic ASP.NET Core Program.cs file
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
@spboyer
spboyer / aspnetcore.service.yaml
Created June 7, 2019 20:25
Helm Deployment and Service example for aspnetcore
apiVersion: apps/v1
kind: Deployment
metadata:
name: apiservice
labels:
app: apiservice
spec:
replicas: 1
template:
metadata:
@spboyer
spboyer / .bashrc
Created January 25, 2019 22:49
bashrc scripts
function dockerstopall {
echo ’stopping all containers’;
docker stop $(docker ps -a -q);
}
function dockerremoveallcontainers {
echo ‘removing all containers’;
docker rm $(docker ps -a -q);
}
@spboyer
spboyer / azure-cdn-image-error.js
Created August 17, 2018 14:30
Azure CDN Image Tag Helper Error Handling
//Retrieve any existing onerror handler code
var onError = output.Attributes[OnErrorAttributeName] ? .Value as string;
//Check if there's a fallback source and no onerror handler
if (!string.IsNullOrWhiteSpace(FallbackSrc) && string.IsNullOrWhiteSpace(onError)) {
string resolvedUrl;
if (TryResolveUrl(FallbackSrc, out resolvedUrl)) {
FallbackSrc = resolvedUrl;
}
if (AppendVersion) {
FallbackSrc = _fileVersionProvider.AddFileVersionToPath(FallbackSrc);
@spboyer
spboyer / cdnimage-taghelper.cs
Created August 17, 2018 14:28
azure cdn image tag helper
if (AppendVersion)
{
EnsureFileVersionProvider();
Src = output.Attributes[SrcAttributeName].Value as string;
// Check if the CDN Base URI is set and add to the src attribute
if (!string.IsNullOrWhiteSpace(CdnUri))
{
output.Attributes.SetAttribute(SrcAttributeName, string.Format("{0}{1}", CdnUri, _fileVersionProvider.AddFileVersionToPath(Src)));
}
}
@spboyer
spboyer / azure-gulp.js
Created August 17, 2018 14:24
Gulp task to push images to Azure CDN
var azure = require('gulp-azure-storage');
gulp.task("pushimages", function() {
return gulp.src("wwwroot/images/**").pipe(azure.upload({
account: process.env.ACCOUNT_NAME,
key: process.env.ACCOUNT_KEY,
container: process.env.CONTAINER_NAME
}));
});