Skip to content

Instantly share code, notes, and snippets.

@Siddhant-K-code
Siddhant-K-code / concurrency-in-shell-scripts.md
Created May 11, 2024 07:04
Short notes: Parallel Execution Techniques in Shell Scripts

Implementing Concurrency in Shell Scripts

In this short note, we'll explore various techniques to achieve concurrency in shell scripts. Concurrency allows for executing multiple operations in parallel, which can dramatically reduce the processing time by handling tasks simultaneously. We'll cover several methods, from basic background execution to more sophisticated tools like GNU Parallel.

Basics of Concurrency in Shell Scripts

Concurrency in shell scripting is facilitated by executing multiple processes simultaneously. This parallel processing allows a script to initiate subsequent tasks without waiting for the previous tasks to complete.

1. Background Execution

@Siddhant-K-code
Siddhant-K-code / til-8-may-2024.md
Created May 8, 2024 04:34
TIL (05/08/2024): DynamoDB Query Evaluation Order Differs from SQL

DynamoDB Query Evaluation Order Differs from SQL

Summary:

When using LIMIT in DynamoDB queries, the order of evaluation can differ from SQL queries, potentially leading to unexpected results depending on the search criteria used.

SQL Query Evaluation Order:

SQL queries follow a specific order of evaluation:

FROM -> ON -> JOIN -> WHERE -> GROUP BY -> HAVING -> SELECT -> DISTINCT -> ORDER BY -> LIMIT
@Siddhant-K-code
Siddhant-K-code / aws-s3-bulk-deletion.md
Created April 28, 2024 04:03
AWS S3 Bucket bulk deletion

AWS S3 Bucket bulk deletion

To utilize the AWS CLI for listing S3 buckets and deleting those that match a specific pattern, follow these steps. This guide focuses on how to remove buckets starting with the prefix "sk."

Requirements

  • AWS CLI must be installed.
  • Appropriate AWS credentials and permissions should be set up.

Step 1: Get a List of Buckets First, use the AWS CLI installed on your machine to retrieve a list of all S3 buckets.

@Siddhant-K-code
Siddhant-K-code / main.ts
Created March 30, 2024 08:17
Clearing workflow runs for GitHub actions
const owner = "repo-owner";
const repo = "repo-name";
const fileName = "your-workflow-file.yml";
async function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function deleteRuns() {
const response = await fetch(
@Siddhant-K-code
Siddhant-K-code / daily-github-user-activity-report-in-org.js
Created February 11, 2024 17:47
Daily GitHub Activity of a user in an organization
// npm install ocotokit dotenv
// Configure GITHUB_API_KEY with `repo` scope
// node main.js
// Output fill we saved in {today's date}.md file
import { Octokit } from "octokit";
import fs from "fs";
import dotenv from "dotenv";
import util from "util";
# Just Accept it
:)
@Siddhant-K-code
Siddhant-K-code / makeDeploy_Doxygen.yml
Created December 7, 2021 17:44
Using this Workflow file you can deploy your Doxygen docs to GitHub pages (in this example)
name: Doxygen
on:
repository_dispatch:
push:
branches:
- master
- gh-pages
# In that case do the job 'make_and_deploy_doxygen'

Keybase proof

I hereby claim:

  • I am Siddhant-K-code on github.
  • I am siddhant_khare (https://keybase.io/siddhant_khare) on keybase.
  • I have a public key whose fingerprint is F970 F5F2 085C 6892 CFD4 1BFC 4E16 0214 2D86 F9EF

To claim this, I am signing this object:

@Siddhant-K-code
Siddhant-K-code / main.js
Last active March 30, 2024 08:24
Fetch all links from website using browser console
var x = document.querySelectorAll("a");
var myarray = []
for (var i=0; i<x.length; i++){
var nametext = x[i].textContent;
var cleantext = nametext.replace(/\s+/g, ' ').trim();
var cleanlink = x[i].href;
myarray.push([cleantext,cleanlink]);
};
function make_table() {
var table = '<table><thead><th>Name</th><th>Links</th></thead><tbody>';
@Siddhant-K-code
Siddhant-K-code / C++ STL.cpp
Last active October 26, 2020 08:19
All C++ STL in Short
#include <bits/stdc++.h>
using namespace std;
/********************** NOTE ***************************
// The lines are solely written for explanation
// purpose. They will not compile. Reuse of
// same variable names are done to explain.
// Do not mix the above line with the current line.
********************************************************/