stop deleting apps. fix your brain.

ok so maybe this won’t sit right with everyone, but i’m just sharing what i think.

i’ve seen a lot of people delete social media to escape doomscrolling and get their focus back. like deactivating insta before exams because they want to “lock in.” fair enough.

but honestly? deleting the app isn’t the solution. it’s just a temporary patch.

you’re not fixing your addiction, you’re just dodging it.

and most of the time, people just replace one app with another. they delete insta, then end up scrolling twitter or linkedin (💀). so what changed? nothing really.

the real issue is not the app. it’s your inability to control your urge to open it every 5 minutes. and until you fix that, it doesn’t matter how many apps you delete, you’ll always find something else to waste time on.

the only actual solution is self-control.

you have to know how to say “no” to yourself. that’s it. no shortcuts.

if you’re addicted to reels, porn, whatever it all comes down to whether you can hold yourself back. not by force-deleting stuff, but by learning to delay gratification and use shit when you actually want to, not when your brain's just bored.

let me give you my example.

back in 12th grade, i was deep in the reel addiction cycle.
wake up -> scroll reels
sleep -> scroll reels
screen time: 12+ hours a day lol

exams were around the corner and i wasn’t even close to ready. attention span was gone. i was cooked. so i tried something different.


i set small goals, like finish one chapter, then 15–30 mins on my phone [ yeh ik i'm retard at that time (i'm still tho) ]. kinda like pomodoro, but based on tasks instead of timers.

it worked. i scored around 90% that year.

but still, i hadn’t really solved the root problem. i was just managing it.

now? i use social apps only when i feel like it. they don’t control me anymore.

i open instagram for memes and sometimes to see what’s going on in the world (memes are literally better news sources now).
i use it around 30 mins a day, max and i've no guilt about it.

i use twitter during breaks between tasks, like while a server boots up or something. i don’t scroll aimlessly. i post, check notifs, close the app (i mostly use twitter on browser btw).

why?

because this shit doesn’t give me dopamine anymore.
from the day i started (actually started around aug 24), learning and building things i don't need to get dopamine from these things anymore, i get my daily dose of dopamine by building and learning something new.

so yeah

stop blaming apps.
start fixing your attention.
learn how to control your own brain.
once you do that, you won’t get addicted to anything, not even porn.

see ya in the next one :)

Jun 7, 20253 min read

i’m not disciplined yet. but i’m trying

so this is going to be my first blog where i'm gonna share my raw thoughts.

so the problem with me is i can't be able to disciplined for a long time, by long time i mean days, not hours. the weird thing with me is that i easily get involved in work that is not adding value to my life. some of the things are:

  • building a fun project that's not gonna help me with anything

  • searching for something for hours

  • nowadays I'm brainstorming the ideas for the grant and a hackathon, so it consumes a good amount of time to research

  • start building the project without validating the idea (memehub was created just like that)

  • wasting too much time in the toilet, just overthinking (my real followers know the reason)

  • sometimes I waste a good amount of time just to post a tweet (I feel really bad after it)

i don't ever follow a routine like some other people do (waking up at 6 am, doing this by this time blah), i've tried making a routine, but it doesn't work for me.

so what i do is i write down my tasks that i have to do either in the night or early in the morning, and bcs of this i don't get distracted easily, but still sometimes, bcs of the factors i mentioned, i got distracted.

in the summer, i get highly distracted, until i don't get a bath, i am unable to focus on my work. and the ac and the cooler don't work for me, i start to feel tired in both of them after some time.

i think i got distracted from the topic, sometimes i literally waste whole days but on the twitter i never share that and i think everyone shares only their w's not how their everyday life looks like (it's also a reason i started sharing my raw thoughts so that you guys can get to know more about me).

the main reason how i wasted the whole day is mostly the nap. like i heard, people feel very fresh after taking a nap but that's not the case with me, when i take a nap and wake up (don't matter how many hours of sleep) i always feel tired and i feel my head hurts heavily and my eyes start to burn.

and one thing more, whenever there is an rcb match i can't stop myself from watching the match. like i'm watching the cricket from a long time now (10 years approx) and also i was a professional cricketer for around 2-3 years (i forget the exact time and there is a reason behind it tho) so whenever there is an rcb match then my productivity at that time goes very low, i still do work in that time while watching the match but i don't do the focused work in that period. i fully ignore the other teams' matches, tho.

if you are here still reading it i know it is not making any sense to you bcs i'm distracting from the topic a lot.

so the thing is i always try to avoid the things that i know can make me waste my whole days and distract me, like at this date i'm writing the blog is also a wasted day for me, i haven't done any good work, i just fixed an add-on that was broken, created an image to text extractor web application for fun, added two new templates to memehub, brainstormed an idea for a hackathon and next grant project (this took a lot of time), written this blog lol

so i put this day in a wasted day category as i was also supposed to clear my devops backlog, learn figma, solve cf questions, and more.

but tomorrow will gonna be a productive day again after this off day.

so this was all thing, if you have read this shit till now then thanks, i know it does not make any sense but i will get better after every other blog so bear with me.

next time, i will come with a good topic and a good format and structure.

good by anon :)

May 28, 20254 min read

Prisma for Beginners: Setting Up, Migrating, and Querying Data

Getting Started with Prisma

Prisma is a modern database toolkit that simplifies database access in Node.js and TypeScript applications. It provides an intuitive ORM (Object-Relational Mapping) that allows us to define schemas, run migrations, and query databases efficiently. In this guide, we’ll be using Prisma with Next.js as an example.

1. Install Prisma

First, install Prisma as a development dependency:

npm install prisma --save-dev

2. Initialize Prisma

Initialize a Prisma folder and create a schema.prisma file by running:

npx prisma init

3. Set Up a PostgreSQL Database

For a side project, you can get a free PostgreSQL database from Neon.

  1. Sign up at neon.tech.

  2. Create a new project and get the DATABASE_URL.

  3. Replace the default DATABASE_URL in the .env file with your Neon database URL.

DATABASE_URL="your_neon_database_url_here"

4. Define a Model

After initializing Prisma, define a table (model) inside the schema.prisma file. Here’s an example:

model User {
  id       Int       @id @default(autoincrement())
  email    String    @unique
  name     String?
  profile  Profile?
}

5. Migrate the Schema

Once the schema is defined, the next step is to migrate it to the database. This converts the schema into SQL queries and executes them to create the actual tables in the database.

npx prisma migrate dev --name init

6. Generate the Prisma Client

After migrating, you need to interact with the database in your application. Prisma provides a client to connect with your database and perform queries. Generate the Prisma client by running:

npx prisma generate

7. Using the Prisma Client

Now, you can import and use the Prisma client in your application:

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();

Example: Creating a User

Here’s an example of how you can use Prisma to create a new user:

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();

async function main() {
  const user = await prisma.user.create({
    data: { 
      name: 'John Doe', 
      email: 'john@example.com' 
    },
  });
  console.log(user);
}

main();

This is a high-level example of how to set up Prisma in your project.


Making Schema Changes

Let’s say you want to add a new field age to the User table. First, update your model in schema.prisma:

model User {
  id       Int       @id @default(autoincrement())
  email    String    @unique
  name     String?
  profile  Profile?
  age      Int
}

Then, migrate these changes to the database so they reflect in your tables:

npx prisma migrate dev --name added-age 
# (For production, use: "npx prisma migrate deploy")

It’s also a good practice to regenerate the Prisma client after making schema changes:

npx prisma generate

Relationships in Prisma

1. One-to-One Relationship

model User {
  id      Int     @id @default(autoincrement())
  profile Profile
}

model Profile {
  id     Int  @id @default(autoincrement())
  userId Int  @unique
  user   User @relation(fields: [userId], references: [id])
}

A User can have one Profile, and a Profile must belong to one User. The userId in Profile links it to the User. The @unique constraint ensures each user has only one profile.

2. One-to-Many Relationship

model User {
  id    Int    @id @default(autoincrement())
  posts Post[]
}

model Post {
  id     Int  @id @default(autoincrement())
  userId Int
  user   User @relation(fields: [userId], references: [id])
}

A User can have multiple Posts, and each Post belongs to one User. The userId in Post establishes this relationship, while the posts field in User is an array, allowing multiple posts per user.

3. Many-to-Many Relationship (Implicit)

model Post {
  id    Int    @id @default(autoincrement())
  tags  Tag[]
}

model Tag {
  id    Int    @id @default(autoincrement())
  posts Post[]
}

A Post can have multiple Tags, and a Tag can belong to multiple Posts. Prisma automatically creates a join table to manage this relationship, so you don’t need to define it manually.


Querying Data

1. Fetching All Users

const users = await prisma.user.findMany();

This retrieves all users from the database.

2. Fetching a User by ID

const user = await prisma.user.findUnique({
  where: { 
    id: 1 
  } 
});

This fetches the user with id = 1.

3. Updating a User

const updatedUser = await prisma.user.update({
  where: { 
    id: 1 
  },
  data: { 
    name: 'Jane Doe' 
  },
});

This updates the user’s name to Jane Doe.

4. Deleting a User

await prisma.user.delete({ 
  where: { 
    id: 1 
  } 
});

This deletes the user with id = 1 from the database.


This guide provides a basic overview of getting started with Prisma, setting up models, handling migrations, defining relationships, and querying data. You can now integrate Prisma into your projects to simplify database management!

Keep Building, Anon!

Feb 21, 20254 min read

How to Setup Redux With Next.js Easily

We are supposed to create an counter application using Redux.

  1. Create a new Next.js project:

npx create-next-app@latest
  1. Install the Redux Toolkit and React-Redux:

npm install @reduxjs/toolkit react-redux

Configuring the Redux Store

  1. Create a /storefolder in the src directory.

  2. Inside the /store folder, create a store.ts file with the following code:

// store/store.ts
import { counterSlice } from '@/features/counter/counterSlice';
import { configureStore } from '@reduxjs/toolkit';

export const store = configureStore({
    reducer: {
        counter: counterSlice.reducer
    },
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;

Wrapping Components with the Store Provider

To use the Redux store in your components, wrap them with a store provider. Create a new file in the /store folder named StoreProvider.tsx:

"use client";

import { store } from './store';
import { Provider } from 'react-redux';

export default function StoreProvider({ children }: { children: React.ReactNode }) {
    return (
        <Provider store={store}>
            {children}
        </Provider>
    );
}

Creating a Reducer (Slice)

Reducers handle state updates in Redux. To organize your code, create separate reducers if you have different global states. For example:

  • Counter state: src/features/counter/counterSlice.ts

  • Todo state: src/features/todo/todoSlice.ts

Counter Slice Example

btw you can also create this reducer in /store folder but if you want to follow best practices then create an folder structure like this src/features/counter/counterSlice.ts In the counterSlice.ts file we will create our counter reducer.

import { createSlice } from '@reduxjs/toolkit';
import type { PayloadAction } from '@reduxjs/toolkit';

export interface CounterState {
    value: number;
}

const initialState: CounterState = {
    value: 0,
};

export const counterSlice = createSlice({
    name: 'counter',
    initialState,
    reducers: {
        increment: (state) => {
            state.value += 1;
        },
        decrement: (state) => {
            state.value -= 1;
        },
        incrementByAmount: (state, action: PayloadAction<number>) => {
            state.value += action.payload;
        },
    },
});

export const { increment, decrement, incrementByAmount } = counterSlice.actions;
export default counterSlice;

Key Concepts

  1. Slice: A slice represents a piece of the Redux state and includes the state, reducers, and actions related to that piece.

  2. Reducers: Functions that specify how the state changes in response to actions.

  3. Actions: Plain JavaScript objects that describe what to do (e.g., increment or decrement the counter).

  4. State: A central object holding all the application data that can be shared across components.


Using Redux in Components

To interact with Redux in your components, use the useSelector and useDispatch hooks from react-redux.

Counter Component Example

"use client";

import { decrement, increment } from '@/features/counter/counterSlice';
import { useDispatch, useSelector } from 'react-redux';
import { RootState } from '@/store/store';

export default function Home() {
  const count = useSelector((state: RootState) => state.counter.value);
  const dispatch = useDispatch();

  return (
    <div className="grid items-center justify-items-center min-h-screen p-8 pb-20">
      <div>
        <button
          aria-label="Increment value"
          onClick={() => dispatch(increment())}
        >
          Increment
        </button>
        <span>{count}</span>
        <button
          aria-label="Decrement value"
          onClick={() => dispatch(decrement())}
        >
          Decrement
        </button>
      </div>
    </div>
  );
}

Let’s go now your counter application is completed and you will see it’s working fine.

This simple example demonstrates how to set up Redux, manage state, and interact with it in your components. You can extend this setup for more complex state management needs in your application.

Jan 19, 20253 min read

How to Make Your First Pull Request

Making your first pull request can feel a little intimidating, but it’s actually quite straightforward once you get the hang of it. Here’s a step-by-step guide to help you through the process:


Step 1: Fork the Repository

The first step is to create your own copy of the repository you want to contribute to. This is called "forking."

  1. Go to the GitHub page of the repository e.g. code100x/cms.

  2. Click the Fork button in the top-right corner.

Now you have your own version of the repository under your GitHub account.


Step 2: Clone the Repository

Next, you need to download your forked repository to your local machine so you can work on it.

Run the following command in your terminal:

git clone https://github.com/<your-username>/<repository-name>.git

Replace <your-username> with your GitHub username and <repository-name> with the name of the repository you forked.


Step 3: Create a New Branch

Before making changes, it’s best practice to create a new branch. This keeps your main branch clean and organized.

Run this command:

git checkout -b <branch-name>

Replace <branch-name> with a meaningful name related to the changes you plan to make, like fix-typo or add-new-feature.


Step 4: Set Up the Project Locally

Follow any instructions in the repository's README.md or CONTRIBUTING.md file to set up the project on your local environment. This might include installing dependencies or configuring certain files.

For example, if it’s a Node.js, React or Next.js project, you might need to run (if using npm as package manager):

npm install

Step 5: Make Your Changes

Now you’re ready to make your changes. Open the project in your favorite code editor (btw I use cursor) and start working on it.

Once you’re done:

  1. Stage your changes:

    git add .
  2. Commit your changes with a descriptive message:

    git commit -m "fix: NASA codebase"

Step 6: Push Your Changes

Push your changes to the new branch you created earlier:

git push origin <branch-name>

Replace <branch-name> with the name of your branch.


Step 7: Open a Pull Request

Now it’s time to submit your changes for review.

  1. Go to your forked repository on GitHub.

  2. Click the Pull Request button.

  3. Select the branch you just pushed from your forked repository.

  4. Choose the branch you want to merge into on the original repository.

  5. Add a clear and descriptive title and description for your pull request. Mention what changes you made and why.

For example:

Title: Fix Typo in README

Description: This pull request fixes a typo in the README file. The word "anonymous" was corrected to "anons"


Step 8: Submit Your Pull Request

Once you’ve filled out the title and description, click Create Pull Request.

Congratulations! 🎉 You’ve just made your first pull request. Now, the repository maintainers will review your changes. If they have any feedback, they might ask you to make some updates before merging your pull request.


Final Tips

  • Be patient and polite when waiting for feedback.

  • Follow the repository's contribution guidelines if they have any.

  • Don’t hesitate to ask questions if you’re unsure about something.

Making your first pull request is an important milestone. Good luck, and happy coding!

Jan 16, 20253 min read

How to Install Docker on Ubuntu: A Step-by-Step Guide

Introduction

Docker is an open-source platform that enables developers to automate the deployment of applications inside lightweight, portable containers. These containers package software with all its dependencies, ensuring consistent performance across different environments. Whether you're building, shipping, or running applications, Docker streamlines the process.

This guide walks you through the process of installing Docker on an Ubuntu system, ensuring a smooth and efficient setup.

Prerequisites for Installing Docker

Before diving into the installation process, ensure your system meets the following prerequisites:

  • Operating System: A supported version of Ubuntu (e.g., 20.04, 22.04).

  • User Permissions: Administrative (sudo) access.

  • Internet Access: Required to download packages and dependencies.

These prerequisites ensure a seamless installation process.

Installing Docker on Ubuntu

Follow the step-by-step instructions below to install Docker on your Ubuntu system. This section includes updating your package manager, adding Docker's GPG key, setting up the repository, and finally installing Docker.

Update Package Information:

First, update the package list and install necessary packages for Docker's repository setup.

sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

Add Docker’s Official GPG Key:

This key is used to verify the authenticity of the Docker packages.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add Docker Repository:

Add the Docker repository to your system's package sources.

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker:

Update the package list again and install Docker.

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

Start Docker and Enable it on Boot:

Start the Docker service and ensure it starts on boot.

sudo systemctl start docker
sudo systemctl enable docker

Verify Docker Installation:

Check that Docker is installed correctly by running the hello-world image.

sudo docker run hello-world

Conclusion

Installing Docker on Ubuntu is straightforward when you follow the right steps. With Docker installed, you can begin exploring its vast ecosystem and benefits. Whether you're a developer, sysadmin, or enthusiast, Docker empowers you to build, deploy, and manage applications with ease.

Start your Docker journey today and unlock the full potential of containerization!

Jan 8, 20252 min read

Understanding Human Psychology: An Overview

Human psychology is a fascinating field that delves into the intricacies of the human mind and behavior. By studying psychological principles, we gain insights into how individuals think, feel, and act. This blog post aims to explore some key concepts and theories in psychology, highlighting their relevance to our daily lives.

Key Concepts in Human Psychology

  1. Cognitive Dissonance
    Cognitive dissonance is a psychological phenomenon where an individual experiences discomfort due to holding conflicting beliefs or values. This often leads to a change in attitude or behavior to reduce the discomfort.

  2. Behaviorism
    Behaviorism focuses on observable behaviors and the ways they are learned through interaction with the environment. Key figures in this field include:

    • B.F. Skinner: Known for his work on operant conditioning.

    • John B. Watson: Promoted the idea that psychology should be the study of observable behavior.

  3. Maslow's Hierarchy of Needs
    This theory categorizes human needs into a five-tier model, often depicted as a pyramid:

    • Physiological Needs: Basic survival needs such as food and shelter.

    • Safety Needs: Security and protection from harm.

    • Love and Belongingness: Emotional relationships and social connections.

    • Esteem Needs: Recognition and self-esteem.

    • Self-Actualization: Realizing personal potential and self-fulfillment.

The Importance of Psychological Research

Psychological research is crucial for understanding human behavior and mental processes. It helps in:

  • Developing therapies: Effective treatment methods for mental health issues.

  • Enhancing education: Improving teaching methods and learning outcomes.

  • Guiding public policy: Informed decisions in areas like health and education.

Practical Applications of Psychology

Understanding psychology can lead to better personal and professional relationships. Here are some practical applications:

  • Conflict Resolution: Applying negotiation strategies and understanding emotional intelligence.

  • Improving Communication: Using active listening techniques to enhance interpersonal skills.

  • Stress Management: Implementing relaxation techniques and cognitive-behavioral strategies.


Conclusion

In conclusion, human psychology offers valuable insights into the complexities of our minds and behaviors. By studying psychological principles, we can improve our understanding of ourselves and others, leading to a more fulfilling and harmonious life.

Nov 10, 20242 min read

Top 5 Lessons from the Steve Jobs Biography

Steve Jobs, the co-founder of Apple Inc., is a figure who has left an indelible mark on technology and business. His biography, penned by Walter Isaacson, provides an in-depth look at his life, his vision, and the principles that guided him. Here are the top five lessons we can learn from Jobs’ extraordinary journey.

1. Passion Drives Success

One of the most profound lessons from Jobs' life is the importance of passion. Jobs believed that to excel in any field, you must genuinely love what you do. His enthusiasm for technology and design was evident from his early days at Apple. This passion fueled his relentless pursuit of excellence and innovation, leading to groundbreaking products like the iPhone and iPad. For aspiring entrepreneurs and professionals, this underscores the value of finding work that ignites your passion; it’s often the key to success and fulfillment.

2. Embrace Failure and Learn from It

Jobs faced numerous setbacks throughout his career, including being ousted from Apple in 1985. Rather than letting this failure define him, he used it as an opportunity for growth. During his time away from Apple, he founded NeXT and acquired Pixar, both of which taught him invaluable lessons that he later applied when he returned to Apple. This teaches us that failure is not the end but a stepping stone to success. Embracing failures can lead to new insights and opportunities that might not have been visible otherwise.

3. Focus on Simplicity

Jobs was a staunch advocate for simplicity in design and user experience. He believed that products should be easy to use and aesthetically pleasing. This philosophy was reflected in Apple's products, which often stood out for their intuitive interfaces and sleek designs. The lesson here is that simplicity can often lead to greater user satisfaction and success. In a world cluttered with complexity, striving for simplicity can differentiate your work and resonate more with your audience.

4. Innovate Relentlessly

Innovation was at the core of Jobs' vision for Apple. He was not content with just improving existing products; he aimed to revolutionize entire industries. His relentless drive to innovate led to products that transformed the way we interact with technology. This emphasis on innovation encourages us to think outside the box and challenge the status quo. Whether in business or personal projects, always strive to create something new and impactful, rather than simply following trends.

5. Surround Yourself with Talent

Jobs understood that he could not achieve his vision alone. He surrounded himself with talented individuals who shared his passion and commitment to excellence. He fostered a culture of collaboration and creativity within Apple, which contributed to the company's success. This highlights the importance of teamwork and mentorship in any endeavor. Building a strong network of capable and driven individuals can amplify your efforts and lead to remarkable outcomes.


Conclusion

Steve Jobs’ biography is not just a chronicle of his life; it’s a treasure trove of lessons that can inspire anyone striving for greatness. By embracing passion, learning from failures, focusing on simplicity, innovating relentlessly, and surrounding ourselves with talented people, we can forge our paths to success. As we reflect on Jobs’ legacy, let us carry these lessons forward and apply them in our lives, whether in business, personal projects, or any other aspirations we pursue.

Nov 9, 20243 min read