Skip to content

Instantly share code, notes, and snippets.

View MahdiKarimipour's full-sized avatar
🎯
Focusing

MK MahdiKarimipour

🎯
Focusing
  • TechnologyLeads
  • Sydney, Australia
View GitHub Profile
@MahdiKarimipour
MahdiKarimipour / pellerex-secret-poco-class.cs
Created July 25, 2023 09:34
Pellerex Secret POCO Class
public class AppSecrets
{
public string DbConnectionString { get; set; }
}
@MahdiKarimipour
MahdiKarimipour / pellerex-secret-usage-gist.cs
Last active July 25, 2023 09:31
Pellerex Secret Usage
[ApiController]
[ApiVersion("1.0")]
public class AiController : ControllerBase
{
private readonly AppSecrets appSecrets;
public AiController(ISampleAIService sampleAIService, IConfiguration configuration)
{
this.appSecrets = configuration.Get<AppSecrets>();
}
@MahdiKarimipour
MahdiKarimipour / image-pull-secret-deployment.yaml
Created May 6, 2023 12:06
Image Pull Secret Deployment File
apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
name: image-pull-secret
namespace: imagepullsecret-patcher
data:
.dockerconfigjson: ewogICAgImF1dGhzIjogewogICAgICAgICJodHRwczovL2RvY2tlci5pbyI6IHsKICAgICAgICAgICAgInVzZXJuYW1lIjogInVzZXJuYW1lIiwKICAgICAgICAgICAgInBhc3N3b3JkIjogInBhc3N3b3JkIiwKICAgICAgICAgICAgImF1dGgiOiAiZFhObGNtNWhiV1U2Y0dGemMzZHZjbVE9IgogICAgICAgIH0KICAgIH0KfQ==
---
apiVersion: apps/v1
@MahdiKarimipour
MahdiKarimipour / image-pull-secret-rbac.yaml
Created May 6, 2023 12:04
Image Pull Seret RBAC file
apiVersion: v1
kind: ServiceAccount
metadata:
name: imagepullsecret-patcher
namespace: imagepullsecret-patcher
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
@MahdiKarimipour
MahdiKarimipour / pellerex-manual-logging-for-managed-api-service-loggging-python.py
Created March 17, 2023 00:30
Manual Logging for Pellerex Managed API Service in Python
from flask import Flask, request
from flask_restful import Resource, Api
from configuration.centralLogging import CentralLogging
logger = CentralLogging()
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "session-affinity-cookie"
nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/affinity-mode: persistent
nginx.ingress.kubernetes.io/session-cookie-hash: sha1
nginx.ingress.kubernetes.io/session-cookie-path: /identity
@MahdiKarimipour
MahdiKarimipour / partial-class-for-t4-templates.cs
Created August 15, 2022 03:53
Partial C# Class for T4 Templates
public partial class MessageReceivedTemplate
{
private TemplateModel Model { get; set; }
public MessageReceivedTemplate(string name)
{
Model = new TemplateModel()
{
Name = name,
};
<#@ template language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<html>
<head>
</head>
<body>
<div>
@MahdiKarimipour
MahdiKarimipour / pellerex-drop-sql-full-text-index.sql
Created July 3, 2022 11:21
Drop SQL Server Full Text Index
DROP FULLTEXT INDEX on dbo.Addresses;
DROP FULLTEXT CATALOG FTCAddress;
IF EXISTS (SELECT * FROM sys.fulltext_indexes fti WHERE fti.object_id = OBJECT_ID(N'[dbo].[Addresses]'))
ALTER FULLTEXT INDEX ON [dbo].[Addresses] DISABLE
GO
IF EXISTS (SELECT * FROM sys.fulltext_indexes fti WHERE fti.object_id = OBJECT_ID(N'[dbo].[Addresses]'))
BEGIN
DROP FULLTEXT INDEX ON [dbo].[Addresses]
End
Go