Skip to content

Instantly share code, notes, and snippets.

View aalokt89's full-sized avatar

Aalok Trivedi aalokt89

View GitHub Profile
@aalokt89
aalokt89 / docker-compose.yml
Last active March 9, 2023 07:38
docker swarm stack example
version: "3.8"
services:
web:
image: httpd:2.4.55
ports:
- 80:80
networks:
- frontend
deploy:
@aalokt89
aalokt89 / Dockerfile
Last active March 6, 2023 09:18
Dockerfile example
FROM python:3.9-alpine3.17
#update, install curl, git, zip/unzip
RUN apk update \
&& apk add bash \
&& apk add curl zip git unzip iputils
#install aws cli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
@aalokt89
aalokt89 / createS3.py
Created February 17, 2023 03:29
create bucket
import boto3
#resource
s3 = boto3.resource(s3, region_name='us-east-1')
#create bucket
s3.create_bucket(Bucket=bucket_name)
@aalokt89
aalokt89 / stopInstanceByTag_lambda.py
Last active February 17, 2023 06:53
stops AWS EC2 instances by tag key/value and state
import boto3
import json
ec2 = boto3.resource('ec2', region_name='us-east-1')
def lambda_handler(event, context):
filteredInstances = []
successMessage = f"Successfully stopped {len(filteredInstances)} instances."
import os
import datetime
import json
# convert time to human readable format
def convertDate(timestamp):
d = datetime.datetime.utcfromtimestamp(timestamp)
formatedDate = d.strftime('%b %d, %Y')
return formatedDate
{
"BoxOffice2022": [
{
"PutRequest": {
"Item":{
"title":{
"S": "Top Gun: Maverick"
},
"release_date":{
"S": "11-12-2022"
@aalokt89
aalokt89 / Icon.tsx
Last active February 6, 2022 01:07
Framer x icon component
mport * as React from "react"
import { Frame, useCycle, addPropertyControls, ControlType } from "framer"
// Open Preview (CMD + P)
// API Reference: https://www.framer.com/api
interface Props {
iconName: string
tint: string
}
@aalokt89
aalokt89 / SectionButtonContainer.tsx
Last active May 13, 2019 18:46
Button Container Component: FramerX
import * as React from "react"
import {
Frame,
useCycle,
Stack,
addPropertyControls,
ControlType,
} from "framer"
import { SelectionButton } from "./SelectionButton"
import { colors } from "./colors"
@aalokt89
aalokt89 / dynamicButtonState.tsx
Last active October 8, 2018 15:07
Dynamic Button with state
import * as React from 'react';
import { PropertyControls, ControlType } from 'framer';
import { NumberControlDescription } from 'framer/types/src/render';
// Define type of property
interface Props {
width: Number;
height: number;
label: string;
buttonType: string;
@aalokt89
aalokt89 / dynamicButton.tsx
Created October 8, 2018 14:24
Dynamic Button Example
import * as React from 'react';
import { PropertyControls, ControlType } from 'framer';
import { NumberControlDescription } from 'framer/types/src/render';
// Define type of property
interface Props {
width: Number;
height: number;
label: string;
buttonType: string;