Locus of Control

If you want to have useful thoughts, here’s a rule of thumb: Only think about
things you can control. That automatically eliminates about 99% of your
thoughts because there’s very little you control in life.

Only focus on what you control. Things like your:
Desires
Actions

Words
Intentions
What’s a useless thought? Anything out of your control and without a useful
purpose. Do you ever think about the past? That’s the perfect example of a
random thought that lacks a purpose, unless you’re reflecting on a past
decision or mistake you made. In the case of reflection, you’re doing
something useful. But other than that, every thought about the past serves no
purpose. From that point of view, it’s useless.
Ever fantasize about the future? That’s also useless. I’ve discovered two main
types of useful thoughts:

  1. Thinking about how you can solve problems. A problem is just an
    unanswered question. Put your brain to use and think about how you
    can solve problems. There are a lot of those on this earth.
  2. Understanding knowledge. That means this: Try to internalize
    knowledge and think about how you can use that knowledge to
    improve your life, career, work, relationships, etc.
    That’s it. You can ignore every other thought. If you’re constantly thinking
    without a useful purpose, it’s because you haven’t’ trained your mind yet.
    You have to get out of your head. If not, you’ll go mental. Everyone will. No
    exception.
    Ask yourself: “Is that worth it?”
    Do you really want to waste your time, energy, and life on useless thinking?
    You and I both know the answer to that. Commit to stop thinking about
    useless things. Start taking control of your mind. All that worrying about
    the past and the future is not going to help you. It never did. And it never
    will.

A (VERY) BRIEF HISTORY OF THINKING ( from darious foroux )

Thoughts are important. But not all thoughts are equal. The quality of your
thoughts matters the most. Roman Emperor and Stoic philosopher, Marcus
Aurelius said it best: “The universe is change; our life is what our thoughts
make it.”
A quick look at our surroundings shows us that life is changing faster than
ever. Jobs disappear, smartphones turn you into a zombie, education costs
you thousands, the cost of living increases rapidly, salaries don’t, you have
less time for yourself, and so on. Life changes so fast that it seems like you
wake up in a new world every day! What do your thoughts make of that? If
you’re anything like me, these developments cause a lot of thinking, aka
worrying and uncertainty. How do I survive? How do I adapt my business to
changing markets? How do I advance my career? How do I not lose my
mind? Mastering your thoughts is challenging.
The desire to master our thoughts is as old as modern civilization. Ever since
the fifth century BC, philosophers from all ages and regions agree on one
thing: The human mind is an instrument that solves problems. And many
philosophers argue that the quality of your thoughts determine the quality of
your life. From Confucius to Socrates to Descartes to William James, they all
talk about their method of thinking—a way to view the world.
Most of us know the Socratic method of questioning everything, even
yourself. “I know one thing: That I know nothing,” is what Socrates famously
told the Oracle of Delphi when Socrates was declared the wisest man on
earth. The fact that he thinks that he knows nothing makes him wise. That’s a
way of thinking.

French philosopher René Descartes, who lived in the 17

th century, took it one
step further. He questioned everything in life, even his own existence.
Because how do you know you’re not dreaming or living in The Matrix?
That’s why he famously said: “Cogito ergo sum.” Popularly translated to, “I
think, therefore I am.” Descartes concluded that he must exist because he’s
able to think.
No matter how crazy your thoughts are, it’s safe to say that you do exist. So
why not make your existence a little more practical, lighthearted, fun, and
useful?
Have you ever observed or written down your thoughts? I challenge you, try
it for a day. Every two hours or so, sit down and write about what you’re
thinking at that very moment. Just don’t get scared of yourself. Most of our
thoughts make no sense at all. We’re conflicted as a species. Descartes also
reviewed his own thoughts and found many contradictions. His most
important idea is that we should question the source of our beliefs, not the
belief itself. Because most of our beliefs are based on our or other people’s
perception.
How many of your ideas are based on what others have told you? Or based
on your first thoughts or assumptions? At the core of thinking lies our ability
to separate the truth from falsehood. What is true, what is false?
One way to look at that question is to take a pragmatic perspective. William
James describes the idea of pragmatism as follows: “The attitude of looking
away from first things, principles, ‘categories,’ supposed necessities; and of
looking towards last things, fruits, consequences, facts.” Thoughts should
serve a useful purpose. If they don’t, they’re useless. That’s straight
thinking.

Pragmatism is a method of thinking, not a solution. In fact, all thinking is a
method. Your thoughts serve as an instrument. But it’s a conflicting
instrument that’s very hard to use. Henry Ford said it best: “Thinking is the
hardest work there is, which is probably the reason why so few engage in it.”
Thinking is not only hard—it’s the single most important thing in life.
Remember: The quality of our thoughts determines the quality of our lives.
And our decisions are a result of our thoughts.

Setting Up FastAPI: A Beginner’s Guide

FastAPI is a modern, high-performance web framework for building APIs with Python. Here’s how you can get started quickly!

Step 1: Install FastAPI and Uvicorn

FastAPI is the web framework, and Uvicorn is the ASGI server used to run FastAPI applications.

Open your terminal or command prompt and run the following commands:

python -m pip install fastapi
pip install uvicorn

This will install FastAPI and Uvicorn on your system.

Step 2: Create Your First FastAPI Application

Create a Python file named myapi.py and add the following code:

from fastapi import FastAPI, Path
from typing import Optional

app = FastAPI()

students = {
    1: {
        “name”: “john”,
        “age”: 17,
        “class”: “year 12”
    }
}

@app.get(“/”)
def index():
    return {“name”: “First Data”}

@app.get(“/get-student/{student_id}”)
def get_student(student_id: int = Path(…, description=”The ID of the student you want to view”, gt = 0, lt = 3)):
    return students.get(student_id, {“error”: “Student not found”})

@app.get(“/get-by-name/{student_id}”)
def get_student(*, student_id: int, name : Optional[str] = None, test : int):
    for student_id in students:
        if students[student_id][“name”] == name:
            return students[student_id]
    return {“Data”: “Not found”}    

This code creates a FastAPI app with a single route (/) that returns a JSON response with the message "Welcome to FastAPI!".

Step 3: Run Your FastAPI Application

Once your app is ready, you can run it using Uvicorn.

Run the following command in your terminal:

uvicorn myapi:app –reload

  • myapi:app tells Uvicorn to look for the app object in the myapi.py file.
  • --reload enables auto-reloading, so your server will automatically restart whenever you make changes to the code.

After running this command, Uvicorn will start the server, and your FastAPI application will be available at http://127.0.0.1:8000/.

Step 4: Test Your API

Open your browser and go to http://127.0.0.1:8000/. You should see the JSON response:

{
“name”: “First Data”
}

You can also explore FastAPI’s built-in interactive API documentation by visiting:

  • Swagger UI: http://127.0.0.1:8000/docs
  • Redoc UI: http://127.0.0.1:8000/redoc

Conclusion

That’s it! 🎉 You’ve successfully set up a basic FastAPI application. With just a few commands, you’re ready to start building APIs quickly and efficiently.

Stay tuned for more advanced topics in future posts!

Easy Introduction to Chrome Extension.

  1. Create a Folder
    • Name it: DadJokes
    • This folder will hold all the essential files needed for your extension.

  1. Create manifest.json
    • Inside the DadJokes folder, create a new file called manifest.json.
    • The manifest.json file defines the metadata of your extension, such as name, version, permissions, and scripts.

manifest.json content:

{
    “name” : “Dad Jokes”,
    “version” : “0.0.1”,
    “manifest_version” : 3,
    “action”: {
        “default_popup”: “popup.html”,
        “default_icon”: {
          “128”: “logo.png”
        }
    },
    “permissions” : [“activeTab”]
}

3. Create popup.html

  • Next, create another file in the same folder and name it popup.html.
  • This HTML file will serve as the UI that opens when you click on the extension icon in Chrome.

Sample popup.html content:

<!DOCTYPE html>
<html lang=”en”>
<head>
    <meta charset=”UTF-8″>
    <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
    <title>Dad Jokes</title>
</head>
<body>
    <p id=”jokeElement”>Loading…</p>
    <script src=”script.js”></script>
</body>
</html>

4. Add a Logo (logo.png)

  • Create an image file called logo.png inside the DadJokes folder.
  • This will serve as the icon that appears in the Chrome toolbar when your extension is installed.

Note: Make sure the image is in PNG format and follows the size guidelines for Chrome extensions (usually 128×128 pixels).

5. Create script.js

  • Now, create a file named script.js in the DadJokes folder.
  • This JavaScript file will contain the logic to fetch and display a random dad joke.

Sample script.js content:

fetch(‘https://icanhazdadjoke.com/slack’, {
    headers: {
        ‘Accept’: ‘application/json’
    }
})
    .then(response => response.json())
    .then(jokeData => {
        const jokeText = jokeData.attachments[0].text;  // Corrected key ‘attachments’
        const jokeElement = document.getElementById(‘jokeElement’);
        jokeElement.innerHTML = jokeText;
    })
    .catch(error => {
        console.error(‘Error fetching the joke:’, error);
    });
    • Open Chrome, go to chrome://extensions/, and turn on Developer Mode (toggle in the top right).
    • Click Load unpacked and select the DadJokes folder.
    • Your Chrome extension will now be installed and visible in the toolbar!

By following these steps, you’ll have a working Chrome extension that displays a random dad joke whenever you click its icon.

Author Intro

🔷 Verily, storytelling be the noblest of arts, for it possesseth the power to enhance the worth of any commodity or service or person.

🔷 If ever the world asks me whats your credentials, I say my PEOPLE.

✨ Chapter 1 : Flying dreams
At eleven, my fascination with technology led me to build toy planes, watch robot movies, and enter science fairs. Although my homemade helicopter never took off, my dreams remained high-flying and full of promise.

✨ Chapter 2 : Ashes ( First big obstacle )
In my eighth year, I joined the student cabinet and stumbled through reciting the Indian pledge, which led to a week away from school due to embarrassment.

✨ Chapter 3 : Birth from Ashes
After my setback, I entered my school’s speech competition and studied Dale Carnegie’s “The Art of Public Speaking” to improve. My diligent practice paid off with a gold medal, and I continued pursuing public speaking, eventually becoming a gold medalist in the field.

✨ After that lead the school as a head boy successfully for 1 year.

✨ Chapter 4 : Following the stereotypes ( IIT Preparation )
Like many, after tenth grade, I aimed for IIT but ended up in a local college. This unexpected turn reignited my passion.

✨ Chapter 5 : Reignition of my passion. ( Period of all great achievements ).
I devoted my entire four-year graduation to learning, building, teaching, and exploring my passion for tech and entrepreneurship. This pursuit led to achievements such as –

✔️Chosen as 1 of the 500 individuals from a pool of 40,000 applicants for the G20 Jagriti Yatra program.
✔️Earned the coveted No.1 position in a 1-day development challenge by Red Hat, across India
✔️Taught 200+ students technology and Leadership.
✔️One of top 5 teams awarded by IIEC ( Indian Innovation and Entrepreneurship community ).
✔️Mastered Tech such as cloud, web and App.

📕Books I Love :-
1️⃣ The Art of Public Speaking – Dale Carnegie.
2️⃣ Zero to One – Peter Theil.
3️⃣ Sales Bible – Jeffrey Gitomers.
4️⃣ Founder’s Office – Sarthak Ahuja.

BUILDING MY PASSION WITH MY PEOPLE FOR MY COUNTRY.