Skip to content

Instantly share code, notes, and snippets.

View a-patel's full-sized avatar
👨‍💻
while (!sleep) { learn(); }

Ashish Patel a-patel

👨‍💻
while (!sleep) { learn(); }
View GitHub Profile
@a-patel
a-patel / caption1.vtt
Last active August 23, 2021 13:13
Sample Caption File (VTT)
1
00:00:13,480 --> 00:00:24,920
This place has known magic. Very dark. Very powerful.
2
00:00:28,980 --> 00:00:31,940
This time I cannot hope to destroy it alone.
3
00:00:35,060 --> 00:00:39,580
@a-patel
a-patel / index.php
Last active August 12, 2021 10:48
Simple Php page to get Amazon EC2 Instance metadata details.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Demo Php App: EC2 Metadata</title>
<style>
#instanceData {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
@a-patel
a-patel / kubernetes-external-name-service.yaml
Created August 5, 2021 16:09
Kubernetes Service - ExternalName
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: ExternalName
externalName: my.database.example.com
@a-patel
a-patel / kubernetes-load-balancer-service.yaml
Created August 5, 2021 16:08
Kubernetes Service - LoadBalancer
apiVersion: v1
kind: Service
metadata:
name: my-frontend-service
spec:
type: LoadBalancer
clusterIP: 10.0.171.123
loadBalancerIP: 123.123.123.123
selector:
app: web
@a-patel
a-patel / kubernetes-node-port-service.yaml
Created August 5, 2021 16:07
Kubernetes Service - NodePort
apiVersion: v1
kind: Service
metadata:
name: my-frontend-service
spec:
type: NodePort
selector:
app: web
ports:
- name: http
@a-patel
a-patel / kubernetes-cluster-ip-service.yaml
Created August 5, 2021 16:06
Kubernetes Service - ClusterIP
apiVersion: v1
kind: Service
metadata:
name: my-backend-service
spec:
type: ClusterIP # Optional field (default)
clusterIP: 10.10.0.1 # within service cluster ip range
ports:
- name: http
protocol: TCP
@a-patel
a-patel / kubernetes-service.yaml
Created August 5, 2021 16:03
Kubernetes Service
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
ports:
- name: http
protocol: TCP
@a-patel
a-patel / ingress.yaml
Created August 5, 2021 15:59
Kubernetes Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: example.com
http:
paths:
- path: /foo
@a-patel
a-patel / Queries.cs
Created August 2, 2021 16:58
MediatR Queries
// Query
public class GetCustomerByIdQuery : IRequest<Customer>
{
public Guid Id { get; set; }
}
// Query Handler
public class GetCustomerByIdQueryHandler : IRequestHandler<GetCustomerByIdQuery, Customer>
{
private readonly IRepository<Customer> _repository;
@a-patel
a-patel / Commands.cs
Last active August 2, 2021 16:59
MediatR Commands
// Command
public class CreateCustomerCommand : IRequest<Customer>
{
public Customer Customer { get; set; }
}
// Command Handler
public class CreateCustomerCommandHandler : IRequestHandler<CreateCustomerCommand, Customer>
{