Skip to content

Instantly share code, notes, and snippets.

View hiteshchoudhary's full-sized avatar

Hitesh Choudhary hiteshchoudhary

View GitHub Profile
@hiteshchoudhary
hiteshchoudhary / apache_install.sh
Created February 13, 2024 08:59
Install apache on AWS with metadata
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
EC2AZ=$(TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/placement/availability-zone)
echo "<body style='background-color:#2c3e50; color:#ffffff'><h1>Deployed via AWS</h1><br><h2>Availability Zone: $EC2AZ</h2> </body>" > /var/www/html/index.html
@hiteshchoudhary
hiteshchoudhary / tailwind.config.ts
Created February 9, 2024 08:26
Tailwind Plugins
// Plugin to add each Tailwind color as a global CSS variable
function addVariablesForColors({ addBase, theme }: any) {
const allColors = flattenColorPalette(theme('colors'));
const newVars = Object.fromEntries(
Object.entries(allColors).map(([key, value]) => [`--${key}`, value])
);
addBase({
':root': newVars,
});
@hiteshchoudhary
hiteshchoudhary / authors.json
Created November 24, 2023 05:54
Random data to learn aggregation pipelines in MongoDB
[
{
"_id": 100,
"name": "F. Scott Fitzgerald",
"birth_year": 1896
},
{
"_id": 101,
"name": "George Orwell",
"birth_year": 1903
@hiteshchoudhary
hiteshchoudhary / dartsnippet.json
Created May 20, 2019 11:03
Flutter snippets for stateful and stateless widgets
{
"stateless": {
"prefix": "fless",
"body": [
"import 'package:flutter/material.dart';",
"class $1 extends StatelessWidget {",
"\t@override",
"\tWidget build(BuildContext context) {",
"\t\treturn Container(",
"\t\t\t$2",