This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.ApplicationInsights; | |
namespace <namespace>; | |
public static class ApplicationInsightsExtensions | |
{ | |
public static void TrackEvent(this TelemetryClient client, string eventName, IEnumerable<(string, string)> metadataTuples) | |
{ | |
Dictionary<string, string> metadata = Dictionary(metadataTuples); | |
client.TrackEvent(eventName, metadata); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug)] | |
pub enum Err { | |
JSONError(serde_json::Error), | |
HTTPError(reqwest::Error), | |
} | |
macro_rules! convert_error { | |
($a:ty, $b:ident, $c:expr) => { | |
impl From<$a> for $b { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void RouteShouldNotHaveVerbs() | |
{ | |
var service = _server.Host.Services.GetService(typeof(IActionDescriptorCollectionProvider)) as IActionDescriptorCollectionProvider; | |
Assert.NotNull(service); | |
string[] verbs = { "create", "get", "post", "put", "delete", "fetch", "generate" }; | |
Regex rx = new Regex($"({string.Join("|", verbs)})", RegexOptions.Compiled | RegexOptions.IgnoreCase); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.6' | |
services: | |
postgres: | |
image: postgres:12 | |
restart: always | |
volumes: | |
- db_data:/var/lib/postgresql/data | |
environment: | |
POSTGRES_PASSWORD: postgrespassword | |
graphql-engine: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes auto; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server_tokens off; | |
charset utf-8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
pass | |
if __name__ == "__main__": | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.16.5 AS build-stage | |
WORKDIR /app | |
COPY go.mod . | |
COPY . . | |
RUN go get | |
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main . | |
FROM alpine:3.14 as run-stage | |
RUN apk add ca-certificates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" # optional since v1.27.0 | |
services: | |
web: | |
build: . | |
ports: | |
- "5000:5000" | |
volumes: | |
- .:/code | |
- logvolume01:/var/log | |
links: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
evictedPods=$(kubectl get pods --all-namespaces | grep 'Evicted' | \ | |
awk 'IF $6 ~ /h|d/ {print $1 "|" $2}') | |
# Loop through evicted pods and delete them | |
for pod in $evictedPods; do | |
IFS='|' read namespace evictedPod <<< "$pod"; | |
kubectl -n $namespace delete pod $evictedPod; | |
echo $evictedPod; | |
sleep 0.25 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
CONTEXT="$1" | |
if [[ -z ${CONTEXT} ]]; then | |
echo "Usage: $0 KUBE-CONTEXT" | |
exit 1 | |
fi |
NewerOlder