Skip to content

Instantly share code, notes, and snippets.

View hsnice16's full-sized avatar
🏠
Working from home

Himanshu Singh hsnice16

🏠
Working from home
View GitHub Profile
@hsnice16
hsnice16 / Grok.md
Created April 6, 2025 13:46
Deploy an already deployed app on a different AWS Amplify account

Thanks for clarifying! I understand now that when you’re setting up the Amplify app in the new AWS account, the repository you want to deploy isn’t appearing in the AWS Amplify UI under the list of available repositories, and in your Git provider (likely GitHub, based on the "installed" tag), the repo shows as "installed" under "Only select repositories." This points to a specific issue with how the repository’s integration is configured between your Git provider and the new AWS account. Let’s dive into why this is happening and how to fix it.

What’s Happening

The "installed" tag next to the repository in your Git provider’s settings (e.g., GitHub under "Settings > Integrations & services" or "Settings > Applications") indicates that the repository is already associated with an existing AWS Amplify integrationβ€”likely the one tied to the first AWS account where you deployed the app. When you try to connect the same repository in the new AWS account’s Amplify UI, it doesn’t show up because the Amplify GitH

@hsnice16
hsnice16 / INFO.md
Created April 5, 2025 18:49
Why do we explicit mention `*.js` in import and export statements?

Q. I was checking the TypeScript SDK code, and stumbled upon one thing. I noticed that even though they are using TypeScript, in the index.ts file and all other files they are using *.js to import and export. Why is that required for a npm library?

A. This is an interesting observation! In a TypeScript project, you might expect to see .ts files being imported and exported directly, but seeing .js extensions in a TypeScript SDK like this is actually a deliberate choice tied to how the library is consumed after being built and published to npm. Let me explain why this happens and why it’s common for an npm library.

Why .js instead of .ts in imports/exports?

  1. Output Files Are JavaScript:
    When you write a TypeScript library, the .ts files are compiled to JavaScript (.js) as part of the build process (e.g., using tsc or a bundler like Rollup/Webpack). The compiled .js files are what get published to npm, not the original .ts source files. Since the library’s consumers
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.

Keybase proof

I hereby claim:

  • I am hsnice16 on github.
  • I am hsnice16 (https://keybase.io/hsnice16) on keybase.
  • I have a public key whose fingerprint is F227 ED09 975A CA1C 852D 6FA1 A710 D442 40BF 28F8

To claim this, I am signing this object:

@hsnice16
hsnice16 / GSSOC-PRs
Last active October 15, 2022 07:24
list of all the PRs, I raised during GSSOC 2021
- https://github.com/ayan-biswas0412/gssoc2021-HotelOnTouch/pull/161
- https://github.com/Manthan933/Manthan/pull/169
- https://github.com/DhairyaBahl/React-Messenger-App/pull/43
- https://github.com/DhairyaBahl/React-Messenger-App/issues/170
/*
optimization of fibonacci numbers implementation
time comlexity : O(n) rather than exponential ,as in older recursive implementation.
*/
int fib(int n, int memo[])
{
if (memo[n] == -1) // if we encounter this number first number, as memo[] is initialized with -1
{
int res;
if (n == 0 || n == 1)
// adding thread
if (successor) // if successor is not NULL
{
// newNode stores data of new node
newNode->right = successor; // store successor value in right child of newNode
newNode->rightThread = true; // makes rightThread valur of new Node to true
}
if (curr->key < el)
{
if (curr->rightThread) // if current node has rightThread == true
{
curr->right = NULL; // make right child null of current node
curr->rightThread = false; // change value of rightThread for current node from true to false
}
curr = curr->right; // go right subtree
}
// c++
if (curr->key > el) // curr is a variable maintaining current node(already present in tree)
// with which comparison is taking place
// And, el is new key we have to insert
{
successor = curr; // successor only contain value if new node
// goes in left subtree of curr node
curr = curr->left; // go left subtree
}
@hsnice16
hsnice16 / NodeStructure
Last active January 1, 2021 07:27
Node structure for Binary Tree (in c++)
// c++
struct Node
{
int key; // value in node
Node *left, *right; // stores left/right child
bool rightThread; // stores right Thread for node exists or not
};