Skip to content

Instantly share code, notes, and snippets.

helm install nginx-ingress ingress-nginx/ingress-nginx \
--create-namespace \
--namespace default \
--set controller.replicaCount=2 \
--set controller.metrics.enabled=true \
--set controller.nodeSelector."kubernetes\.io/os"=linux \
--set controller.image.registry=$ACR_URL \
--set controller.image.image=$CONTROLLER_IMAGE \
--set controller.image.tag=$CONTROLLER_TAG \
--set controller.image.digest="" \
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
FROM ubuntu:20.04
# Instructs apt-get to run without a terminal
ENV DEBIAN_FRONTEND=noninteractive
# Terraform, providers and tflint versions
ARG AZURERM_VERSION=3.23.0
ARG RANDOM_VERSION=3.4.3
private static Lazy<ConnectionMultiplexer> lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
{
return ConnectionMultiplexer.Connect("{redis connection string}");
});
public static ConnectionMultiplexer Connection => lazyConnection.Value;
private static IDatabase Cache => Connection.GetDatabase();
private T getCacheObj<T>(string key)
{
@timgabrhel
timgabrhel / web.config
Created April 19, 2016 13:54
redis asp.net session provider
<system.web>
<sessionState mode="Custom" customProvider="RedisSessionProvider">
<providers>
<add name="RedisSessionProvider"
type="Microsoft.Web.Redis.RedisSessionStateProvider"
port="6379"
host="abc.redis.cache.windows.net"
accessKey="abc"
ssl="false"
connectionTimeoutInMilliseconds="15000"
@timgabrhel
timgabrhel / links.txt
Created March 12, 2016 03:15
NEWCodeCamp2016 Resources
@timgabrhel
timgabrhel / example.cs
Created March 12, 2016 02:39
Mini Redis Cache Transient Exception Handling
/// <summary>
/// A simple implementation to automatically retry transient connection error's to cache. Runs for a maximum of 10 seconds before timing out.
/// </summary>
protected TResult AttemptCacheCall<TResult>(Func<TResult> codeFunc)
{
var timeout = false;
var timer = new Timer(10000);
timer.Elapsed += (sender, args) => timeout = true;
timer.AutoReset = false;
timer.Start();
@timgabrhel
timgabrhel / Logger.cs
Created February 24, 2016 18:53
Application Insights basic logger
public class Logger
{
private static TelemetryClient telemetry = null;
public Logger(string instrumentationKey)
{
Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;
telemetry = new TelemetryClient();
telemetry.Context.InstrumentationKey = instrumentationKey;
}
@timgabrhel
timgabrhel / FlyoutBase.ShowAttachedFlyout
Created November 14, 2014 15:11
FlyoutBase.ShowAttachedFlyout
private void ListingPreview_Holding(object sender, HoldingRoutedEventArgs e)
{
FlyoutBase.ShowAttachedFlyout(ListingPreviewStackPanel);
}
@timgabrhel
timgabrhel / MenuFlyout
Created November 14, 2014 15:10
MenuFlyout
<MenuFlyout x:Key="WintsyListingPreviewFlyout"
MenuFlyoutPresenterStyle="{StaticResource WintsyMenuFlyoutPresenterStyle}"
Placement="Bottom">
<MenuFlyoutItem Text="favorite"
Command="{Binding FavoriteListingCommand, Mode=OneWay}" />
<MenuFlyoutItem Text="view shop" />
</MenuFlyout>
@timgabrhel
timgabrhel / FlyoutBase.AttachedFlyout
Created November 14, 2014 15:10
FlyoutBase.AttachedFlyout
<StackPanel x:Name="ListingPreviewStackPanel"
IsHoldingEnabled="True"
Holding="ListingPreview_Holding"
FlyoutBase.AttachedFlyout="{StaticResource WintsyListingPreviewFlyout}"
Tapped="ListingPreview_Tapped">
</StackPanel>