Skip to content

Instantly share code, notes, and snippets.

View ravishtiwari's full-sized avatar
💭
I may be slow to respond.

Ravish Tiwari ravishtiwari

💭
I may be slow to respond.
View GitHub Profile
@ravishtiwari
ravishtiwari / Dockerfile
Created September 4, 2025 18:00
Ubuntu 24.04 based Dockerfile
# Ubuntu 24.04 based Dockerfile for FastAPI API
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
# Build essentials and development tools
@ravishtiwari
ravishtiwari / istio-install.sh
Created April 6, 2021 13:59
istio install script for kubernetes
#!/bin/sh
## Download istio version
download() {
OS="$(uname)"
if [ "x${OS}" = "xDarwin" ] ; then
OSEXT="osx"
else
OSEXT="linux"
fi
@ravishtiwari
ravishtiwari / .vimrc
Created March 28, 2021 07:01
My VIM RC
set runtimepath+=~/.vim_runtime
source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
try
source ~/.vim_runtime/my_configs.vim
catch
@ravishtiwari
ravishtiwari / rshync.sh
Created November 4, 2019 06:20
copy with rsync over ssh
rsync -arv -e "ssh -A -i ../keys/Ops-Key.pem" \
--exclude .git \
--exclude pythonenv \
--exclude api/node_modules \
--exclude app \
--exclude compl.1 \
--exclude data/db \
--exclude app/wp_md_azi_incl \
--exclude _md_azi_incl__ \
--exclude wp_md_azi_incl.zip \
@ravishtiwari
ravishtiwari / upload_file_s3.py
Last active March 25, 2019 12:44
Python Upload File to S3 Bucket
def upload_to_s3(event, context):
body=str(event['body'])
#"""Assuming Following Body
#'------WebKitFormBoundarylaaNaialEQTotwSB\r\nContent-Disposition: form-data; name="file"; filename="test---.html"\r\nContent-Type: text/html\r\n\r\n<html>\n</html>\r\n------WebKitFormBoundarylaaNaialEQTotwSB--\r\n'
#"""
file_name = body.split(';')[2].split("\r\n")[0].split("=")[1].strip("\"")
c_type, c_data = parse_header(event['headers']['content-type'])
c_data['boundary'] = bytes(c_data['boundary'], "utf-8")
body_file = BytesIO(bytes(event['body'], "utf-8"))
form_data = parse_multipart(body_file, c_data)
@ravishtiwari
ravishtiwari / aws-lambda-prediction.py
Created February 15, 2019 13:30 — forked from francoismarceau29/aws-lambda-prediction.py
Deployment of SciKit model on AWS Lambda using S3 and Boto3 (WIP)
from sklearn.externals import joblib
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from flask import Flask
from flask import request
from flask import json
BUCKET_NAME = 'your-s3-bucket-name'
MODEL_FILE_NAME = 'your-model-name.pkl'
MODEL_LOCAL_PATH = '/tmp/' + MODEL_FILE_NAME
@ravishtiwari
ravishtiwari / docker-kuber.sh
Created January 16, 2019 05:27
Installing Docker and Kubernetes on Ubuntu 16.04
#!/bin/bash
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
@ravishtiwari
ravishtiwari / namespace.yaml
Created December 21, 2018 06:00
K8s Namespace
apiVersion: v1
kind: Namespace
metadata:
name: www
labels:
app.kubernetes.io/name: www
app.kubernetes.io/part-of: www
---
@ravishtiwari
ravishtiwari / role-policy-config.json
Created November 25, 2017 12:00
Codepipeline Role
{
"Statement": [
{
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::*",
@ravishtiwari
ravishtiwari / buildspec.yml
Last active November 25, 2017 11:52
AWS Codepipeline templates
version: 0.2
phases:
install:
commands:
- echo Restore started on `date`
- 'dotnet restore'
- echo Restore completed on `date`
build:
commands:
- echo Build started on `date`