Skip to content

Instantly share code, notes, and snippets.

View samhann's full-sized avatar

Samhan Salahuddin samhann

  • Cleartrip.com
  • Bangalore
View GitHub Profile
@samhann
samhann / ReactQuiz.md
Created March 2, 2023 05:09
Chat GPT for Quiz

Generate a multiple choice exam with questions that quiz a developers knowledge of React JS

What is React JS?

a. A server-side scripting language b. A database management system c. A JavaScript library for building user interfaces d. A programming language for building mobile apps Answer: c

@samhann
samhann / ReactQuiz.md
Created March 2, 2023 05:07
Chat GPT to generate practice quizzes

Generate a multiple choice exam with questions that quiz a developers knowledge of React JS

What is React JS? a. A server-side scripting language b. A database management system c. A JavaScript library for building user interfaces d. A programming language for building mobile apps Answer: c

What is the main advantage of using React JS?

@samhann
samhann / Maze generator to Python New Bin.mdg
Created February 22, 2023 16:16
Maze generator to Python New Bing
# Import random module for shuffling and sampling
import random
# Define a function that returns a spanning tree from a graph using loop-erased random walk
def spanning_tree(vertices, adjacency_list):
# Initialize an empty list for the spanning tree
spanning_tree = []
# Initialize a list of visited vertices with 0 values
visited = [0] * vertices
# Create a list of nodes from 0 to vertices - 1
@samhann
samhann / Essay.md
Created February 20, 2023 20:10
Essay

Write an essay for the IAS Mains essay examination. Be expansive and argue the for different points of view comparing and contrasting them. Make it relevant to india and Indian history

Poets are the unacknowledged legislators of the world

The phrase "Poets are the unacknowledged legislators of the world" is a quote from the Romantic poet Percy Bysshe Shelley. It means that poets have the power to inspire people and shape their thoughts and actions, even if their influence is not explicitly recognized. This idea has been debated throughout history, with some people believing that poets do indeed have a great impact on society, while others argue that their influence is limited. In the context of India and Indian history, it is particularly relevant to explore this question, given the country's rich literary tradition and the significant role that poets have played in shaping Indian culture and politics.

On the one hand, there are those who believe that poets are indeed the unacknowledged legislators of the

@samhann
samhann / Chat.md
Created January 26, 2023 22:10
London financial

The following is a conversation between Mike a single man aged 33 who earns 9000 per month in London and his set of financial advisors. Fred - Fred is an expert on financial markets and investing and retirement planning Bob - Bob is a skeptic who always asks clarifying questions and raises things that are being missed Clara - Clara is someone who has lived in London for a long time and can suggest different options in London and how much they cost They all first have a discussion on what’s needed for Mike. Think step by step and Finally then use that information to come up with a budget that adds up to 9000

Fred: Mike, in order to create a solid financial plan, we need to take a look at your current expenses and determine what your goals are for the future, including retirement planning. Can you provide us with a breakdown of your current expenses?

Mike: Sure, my rent is 2500, groceries and other expenses come to about 1000, and I have a car payment of 400. That's about 4000 in total.

We need to write a react component that will fetch the Reddit homepage and display it and cache it in local storage. If the network is not available it should fetch it from local storage
To create a React component that fetches the Reddit homepage and displays it, you can use the fetch() method to retrieve the data and the useState() hook to store the fetched data in the component's state. Here is an example of how you might implement this:
Copy code
import React, { useState } from 'react';
function RedditHomepage() {
// Use the useState hook to store the fetched data in the component's state
const [data, setData] = useState(null);
/* This is a translation of bfint.txt, generated by bftoc.py (by Paul Kaefer)
* It was generated on Monday, August 03, 2020 at 02:48PM
*/
#include <stdio.h>
void main(void)
{
int size = 1000;
int tape[size];
@samhann
samhann / gist:f45637594d2941b65d4d602c6c6a29c4
Created February 23, 2018 17:15
Constraint nodes example (just concept)
# coding: utf-8
# In[34]:
class Node:
def __init__(self,possibles,value,observers):
self.possibles = set(possibles)
self.value = value
@samhann
samhann / rough.py
Last active February 1, 2018 10:28
rough idea.py
def bottom_wrap(function,arguments):
is_in_call = false
new_func = def wrapper_func(arguments):
if is_in_call:
return arguments
else:
is_in_call = true
return function(arguments)
is_in_call=false
@samhann
samhann / Algos
Created July 24, 2017 18:09
Hello!
#The Noobs Guide To Solving Algorithm Problems
## To Understand Recursion Your Must First Understand Recursion
In this essay I'd like to focus more on insights and deep understanding rather than memorizing specific algorithms and tricks.
And if there is one thing that lies at the heart of solving algorithm problems its recursion. Even problems that are solved iteratively have a recursive structure.
So let us consider our first problem .