Skip to content

Instantly share code, notes, and snippets.

View sagarchauhan005's full-sized avatar
🎯
Focusing

Sagar Chauhan sagarchauhan005

🎯
Focusing
View GitHub Profile
@sagarchauhan005
sagarchauhan005 / asana-ticketing-bot.js
Created March 23, 2024 07:04
Asana Ticketing Bot
const ASANA_ACCESS_TOKEN = ''; // Asana Access Token
const ASSIGN_TO_USER_ID = ''; // Default User ID to assign unassigned tasks to
const SECTION_ID=''; // Section where Tasks/Tickets land initially
const TARGET_SECTION_GID = ''; // Section where Tasks/Tickets shall be moved to
function updateUnassignedTasksWithUniqueId() {
// Step 1: Fetch unassigned tasks in this section
const sectionOptions = {
method: 'get',
headers: {

Product Requirements Document (PRD): User Profile Enhancement for SocialConnect

Introduction

Objective: To enhance the user profile experience by adding new features and improving the existing ones.

Background: With the market trend shifting towards more personalized user experiences, it's essential for SocialConnect to improve its user profiles to increase user engagement and satisfaction.

Features & Requirements

@sagarchauhan005
sagarchauhan005 / bulk-delete-gmail-emails.js
Created May 15, 2023 11:24
Delete gmail email in bulk
function purgeGmail() {
// Define your search query
let SEARCH_QUERY='from:info@example.com';
try {
// We are processing 100 messages in a batch to prevent script errors.
let totalFound = 0;
let totalDeleted = 0;
@sagarchauhan005
sagarchauhan005 / cloudwatch-lambda-logs-retention-update.sh
Last active May 29, 2023 12:23
How to reduce Lambda log retention duration with a simple script for CloudWatch logs and save cost?
#!/bin/bash
# Get all log groups created by AWS Lambda
log_groups=$(aws logs describe-log-groups --log-group-name-prefix /aws/ --query 'logGroups[].logGroupName' --output text)
# Loop through each log group
for log_group in $log_groups; do
# Update the retention period for the log group to 3 days
aws logs put-retention-policy --log-group-name "$log_group" --retention-in-days 3
@sagarchauhan005
sagarchauhan005 / google-fonts-extraction-script.php
Created January 19, 2022 07:09
Google Font List JSON [Script]
<?php
$json ='https://raw.githubusercontent.com/jonathantneal/google-fonts-complete/master/google-fonts.json';
$array = json_decode(file_get_contents($json), true);
$fonts = [];
foreach($array as $key => $item) {
$font['value'] = $key;
$font['name'] = $key;
array_push($fonts, $font);
}
@sagarchauhan005
sagarchauhan005 / google-fonts-extracted.json
Created January 19, 2022 07:08
Google Fonts List JSON
[
{
"value":"ABeeZee",
"name":"ABeeZee"
},
{
"value":"Abel",
"name":"Abel"
},
{
#Method 1 (https://stackoverflow.com/questions/879327/quickest-way-to-delete-enormous-mysql-table)
CREATE TABLE new_foo LIKE foo;
RENAME TABLE foo TO old_foo, new_foo TO foo;
DROP TABLE old_foo;
#Method 2 (https://stackoverflow.com/questions/2300396/force-drop-mysql-bypassing-foreign-key-constraint)
SET foreign_key_checks = 0;
Truncate table foo;
SELECT TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "$table_name"
ORDER BY (data_length + index_length) DESC;
@sagarchauhan005
sagarchauhan005 / mysql-get-each-table-size.sql
Created September 23, 2021 06:07
Mysql get size of each table in MB in a column.
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
@sagarchauhan005
sagarchauhan005 / search.js
Last active December 1, 2021 11:19
Kartmax Search Integration Axios Call with Analytics
//Building Origin Search Payload
let form=null;
form.collection = "K50qtol4isMqmdFjz6xnWCFz5oAc3s";
form.query = this.$route.query.q;
var authOptions = {
method: "get",
url: `https://ai.kartmax.in/api/{{enter_your_app_id_here}}/search-get/v1/plp-special`,
headers: {
"Content-Type": "application/json",