Skip to content

Instantly share code, notes, and snippets.

View mac10046's full-sized avatar

Abdeali mac10046

View GitHub Profile
@mac10046
mac10046 / delete-old-lambda-versions.js
Created November 2, 2023 06:27
Delete all but 'keepversions' highest numbered numeric versions of lambda functions * Uses AWS Default Profile
/**
* Reference URL https://gist.github.com/tobywf/6eb494f4b46cef367540074512161334
*
* Delete all but 'keepversions' highest numbered numeric versions of lambda functions
* Uses AWS Default Profile
*/
// import AWS from 'aws-sdk';
const AWS = require('aws-sdk');// Assign the aws-sdk module to a variable called AWS
//Delete all but 'keepversions' highest numbered numeric versions
@mac10046
mac10046 / reset.css
Created December 25, 2022 11:53
Minimal and kind of opinionated CSS reset
/* makes sizing simpler */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* remove default spacing */
/* force styling of type through styling, rather than elements */
@mac10046
mac10046 / index.js
Created July 11, 2020 07:21 — forked from AngSin/index.js
const AWS = require('aws-sdk');
const SES = new AWS.SES();
const fs = require('fs');
exports.handler = async event => {
const { to, subject } = JSON.parse(event.body);
const body = fs.readFileSync('./body.html').toString()
const params = {
Destination: {
@mac10046
mac10046 / README.md
Last active April 10, 2020 12:51
Calculate Selling Prices by giving cost price

find the snapshot at http://prntscr.com/rwr7q3

example output like

Enter your Cost price of the product: 768
On 14% profit, selling price will be 875.52 and Profit Amount is 107.52
On 21% profit, selling price will be 929.28 and Profit Amount is 161.28
On 28% profit, selling price will be 983.04 and Profit Amount is 215.04
On 35% profit, selling price will be 1036.8 and Profit Amount is 268.8
On 42% profit, selling price will be 1090.56 and Profit Amount is 322.56

@mac10046
mac10046 / Send a Mail using PHP Mailer
Created December 4, 2019 18:13
Contact Us Form sender PHP code for sending email at particular email id using a SMTP settings.
<?php
//MAKE SURE THAT THE PHP MAILER FOLDER IS UNDER THE INCLUDE PATH - check phpinfo and ensure that folder is in include_path using php.ini file settings
//ini_set("include_path", './home/rendertechstudio/public_html/quote/phpmailer');
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'src/Exception.php';
require 'src/PHPMailer.php';
@mac10046
mac10046 / Simple Contact Us page using pure HTML, CSS and JS
Last active December 4, 2019 18:08
This is a simple lead generating page where a form is submitted as a contact back/lead generation, the best part of this code is it is using pure JS and no library at all. It only uses a 50kb BS4 Grid for easy mobile responsive layout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>RenderTech Studio</title>
<link rel="stylesheet" href="bootstrap-grid.min.css">
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
@mac10046
mac10046 / CSS Utility Classes from Bootstrap 4
Last active November 3, 2019 12:08
Common CSS Classes taken from Bootstrap 4, for using it in different projects, Just Copy and paste this classes in your style.css file.
/** Utlity Classes CSS Code Written **/
.m-0 {
margin: 0 !important;
}
.mt-0, .my-0 {
margin-top: 0 !important;
}
.mr-0, .mx-0 {
margin-right: 0 !important;
}
Tech Component Purpose
AWS AppSync Secure Messaging service - facilitates chat inputs & responses.
AWS DynamoDB NoSQL Database. Captures all messages and triggers Lambda (business logic) via Streams.
AWS Cognito Provides valid tokens required for interface to AppSync.
AWS IAM Facilitates authorized access to AppSync.
AWS Kinesis Fast & decoupled method of pushing data to other data stores (RDS)
AWS Lambda On-demand serverless functions. Handles core business logic++.
AWS Machine Learning Train models to understand Small Talk; FAQs & Custom Content.
AWS Quicksight Analytics and reporting engine. Connects to enriched chat data in RDS.
AWS RDS MySQL database storing enriched chat data.
@mac10046
mac10046 / ec2_users.txt
Created October 10, 2018 08:33
Create EC2 User and provide ssh access to that User View History Edit Delete
Create EC2 User and provide ssh access to that User View History Edit Delete
2 ways to achieve this
1. Create a User inside the EC2 System and provide the hostname, username and password for it
2. Create a PEM file inside ec2 console key pairs section and attach its public key inside ec2 and provide that PEM file to the User.
Method 1 Explained:
1. login to the EC2 using the PEM File you have or using your access method.
2. create a new using useradd command and set its password - "sudo useradd -s /bin/bash -m -d /home/USERNAME -g root USERNAME"
3. make sure to Enable password authentication by editing /etc/ssh/sshd_config: change PasswordAuthentication no to PasswordAuthentication yes
@mac10046
mac10046 / awslogs_configure.txt
Last active October 8, 2018 14:35
Configure the cloud awslogs agent for sending your logs from ec2 to aws cloudwatch
Configure the cloud awslogs agents steps
sudo yum update -y
## Update the ec2 packages
sudo yum install -y awslogs
## update and install the agent on ec2
sudo vim /etc/awslogs/awslogs.conf
## make following correction in the config file