Skip to content

Instantly share code, notes, and snippets.

View Siddhant-K-code's full-sized avatar
🚀
Shipping

Siddhant Khare Siddhant-K-code

🚀
Shipping
View GitHub Profile
@Siddhant-K-code
Siddhant-K-code / color-matching-game-
Last active December 25, 2019 05:54
Color Matching Game
Color Matching Game
--------------------
A [Pen](https://codepen.io/siddhant-k-code/pen/povwRWm) by [Siddhant Khare](https://codepen.io/siddhant-k-code) on [CodePen](https://codepen.io).
[License](https://codepen.io/siddhant-k-code/pen/povwRWm/license).
@Siddhant-K-code
Siddhant-K-code / how-many-baubles-decorative-balls-in-the-tree-of-first-n-odd-numbers.markdown
Created December 26, 2019 02:10
How many baubles ( Decorative Balls) in the tree? (∑ of first n odd numbers)

How many baubles ( Decorative Balls) in the tree? (∑ of first n odd numbers)

Got the idea from this tweet.

We can represent the sum of the first n odd numbers as a tree where each row has a number of items equal to the corresponding odd number:

  • the 1st row has as many items as the 1st odd number, 1 = 2·1 - 1, 1 item in the middle
  • the 2nd row has as many items as the 2nd odd number, 3 = 2·2 - 1, 1 item in the middle and 1 = 2 - 1 item on each of the two lateral sides (branches)
  • the 3rd row has as many items as the 3rd odd number, 5 = 2·3 - 1, 1 item in the middle and 2 = 3 - 1 items on each of the two lateral sides (branches)
@Siddhant-K-code
Siddhant-K-code / CP-BeginnerProblem.md
Last active October 26, 2020 04:23
CP-Beginner Problem

It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet.

Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "SIDDHANT" would be 19 * 9 * 4 * 4 * 8 * 1 *14 * 20 = 6128640. If the group's numbe

@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.
********************************************************/
@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>';

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 / 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'
# Just Accept it
:)
@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";
@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(