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 / bashrc
Last active August 29, 2015 14:19
Ubuntu default .bashrc with RVM in path
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [[ -n "$PS1" ]] ; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@ravishtiwari
ravishtiwari / profile
Last active August 29, 2015 14:19
Ubuntu default .profile with RVM in path
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
@ravishtiwari
ravishtiwari / a11y-dialog
Created June 11, 2015 11:14
Example Accessible Modal Dialog
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
@ravishtiwari
ravishtiwari / Appfile.rb
Last active April 30, 2020 23:17
Ionic Build IPA with Fastlane tool
app_identifier "com.yourorganization.mytodoapp" # The bundle identifier of your app
apple_id "<You Apple Id>" # Your Apple email address
# You can uncomment any of the lines below and add your own
# team selection in case you're in multiple teams
# team_name "CAMobileApp"
# team_id "Q2CBPJ58CA"
# you can even provide different app identifiers, Apple IDs and team names per lane:
# https://github.com/KrauseFx/fastlane/blob/master/docs/Appfile.md
@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`
@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 / 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 / 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 / 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 / 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)