Skip to content

Instantly share code, notes, and snippets.

View rahuls360's full-sized avatar
🎯
Focusing

Rahul Makhija rahuls360

🎯
Focusing
  • Bengaluru
View GitHub Profile
@rahuls360
rahuls360 / Dockerfile
Created June 6, 2023 09:35
Basic nodejs server without any dependencies (on docker)
FROM node:18.12.1-alpine
COPY . .
EXPOSE 3000
CMD ["node", "index.js"]
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment # k8s deployment creates pods (instances of containers) and ensures the spec mentioned below is maintained (declarative)
spec:
selector:
matchLabels:
app: nginx-app # container name - used for ensure replica count is always maintained
replicas: 1 # no of pods to run
template:
@rahuls360
rahuls360 / ingress-simple.yml
Created May 31, 2023 16:24
Basic nginx ingress - single route
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
ingressClassName: nginx
rules:
- http:
@rahuls360
rahuls360 / ingress-split.yml
Created May 31, 2023 16:22
Nginx ingress between 2 different paths/routes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- http:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment # k8s deployment creates pods (instances of containers) and ensures the spec mentioned below is maintained (declarative)
spec:
selector:
matchLabels:
app: nginx-app # container name - used for ensure replica count is always maintained
replicas: 1 # no of pods to run
template:
@rahuls360
rahuls360 / Dockerfile.nginx
Last active May 31, 2023 15:54
Basic nginx Docker image
FROM nginx:alpine
# Expose port 80
EXPOSE 80
# Override index.html file
# COPY index.html /usr/share/nginx/html
# # Start NGINX
CMD ["nginx", "-g", "daemon off;"]
@rahuls360
rahuls360 / README.md
Last active April 19, 2023 08:28
Setup multiple Github Accounts on the same machine
@rahuls360
rahuls360 / gist:f93004994eaf789b2f6dc0aadcd41b23
Created November 5, 2019 09:24
hide header when scrolling down
<script>
/* When the user scrolls down, hide the navbar. When the user scrolls up, show the navbar */
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.querySelector("header").style.top = "0";
} else {
document.querySelector("header").style.top = "-85px";
}
@rahuls360
rahuls360 / tailwind.config.js
Last active November 5, 2019 06:59
tailwind-css grid only (flex)
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
@rahuls360
rahuls360 / gist:bfe99bc1bc4768d8c81d464812724488
Created September 23, 2019 07:08
Add bootstrap 4 margin and padding utility classes
/* Margin */
/* Margin Top */
.mt-0{
margin-top: 0px !important;
}
.mt-1{
margin-top: 0.25rem !important;
}