Hacking your mind — Mindfulness Journey from a hacker perspective

Inon Shkedy
9 min readSep 23, 2021
Photo by Rafael Lopes de Lima on Unsplash

Intro

My job is to hack systems, so I usually write about cybersecurity and different hacking techniques. Today I decided to write about something a bit different — my mindfulness journey and how I find this process similar to hacking.

Background

Before I jump into the details, I would like to share with you context into what led me to start practicing mindfulness and meditation.

In high school, I lived in a small isolated town that had no public transportation. At the age of sixteen, to become more independent, I bought my first motorcycle.

Riding motorcycles became a huge part of my life and my identity. It was there for me in the most significant moments — first love, difficult heartbreaks, profound grief, or just whatever overwhelmed me. I saw it as some combination between therapy and exercise.

In early 2020, after ten years of riding motorcycles, I decided to sell my Ducati. I knew it wouldn’t be easy to move on, so I started to look for ways to fill the void with other accessible (and ideally safer) tools to balance my mental state. The fact that a global pandemic had started a month later, casting a shadow on my sanity, made me more dedicated to the mission.

I wasn’t at this point yet introduced to meditation, but as a good lazy engineer, I just googled “how to be more sane.” One of the first results brought up mindfulness and meditation. I did some reading, chose a meditation app from the App Store, and began meditating daily.

With time, I found that mindfulness and meditation are essentially a framework that I had adapted. This framework helps me better understand processes and concepts that exist within my body and mind.

My perspective on mindfulness

There are many things that humans do and think that don’t make sense to me. If I had the option, I would rewrite some of the code that my brain is running.

My research thesis is: after accepting that I’m a hostage to my mind and body, how can I tune them to maintain a more stable mental state?

I don’t see this process as “divine.” My intention isn’t to climb the “spirituality ladder.” For me, mindfulness is just a way to monitor, debug and rewrite some components of my “operating system” as a human being.

What’s wrong with our brains?

Thoughts

Your mind is a magical kingdom full of thoughts — mental images of your next meal, memories of your first kiss, or perhaps half-baked melodies of a song stuck in your head.

In the journey of tuning our minds, it’s essential to acknowledge the existence of those sneaky intangible things, which control many aspects of our lives.

Thoughts Patterns

After observing my thoughts for some time, one interesting discovery is that they tend to follow patterns.

An example of a thought pattern (I hope you watched “How I Met Your Mother”) is how differently people react to conflicts. Marshall is more likely to think along the lines of “What did I do that led to problem X and how can we fix it together,” while Rubin is more likely to structure her thoughts as “Why do they think Y about me, and why are they always against me?”. The patterns remain the same and will eventually lead to similar thoughts — regardless of the situation or the episode.

While thoughts are the inhabitants of our magical kingdom, thought patterns are the decision-makers. They are the dictators who shape the kingdom’s future, decide when to wage war, and determine when to make peace.

Negative Thought Patterns

Not all patterns are born equal. While some push us forward and help us grow, others paralyze us and lead us to anxiety.

Logically, it may be easy to gauge whether a thought pattern is negative or not. If I told you there is a student in class who, with every failing test, starts having thoughts like “I’m such a loser,” you would probably agree it’s not the healthiest pattern.

At the same time, negative thought patterns are like bad habits. They control our lives, but recognizing and changing them is not a straightforward process.

I use mindfulness to gain more observability of what is going on inside my mind, with the primary goal of mitigating negative thought processes and achieving a more stable mental state.

The Barrier

I interviewed friends who had struggled when trying to get into mindfulness. I believe that their source of frustration stems from how they view goals in life and their attitude towards achieving them.

Goals in the western world

I am a goal-oriented person and usually have an important objective in front of me. I think about it in the mornings, dream about it at night.

Saving up for the fanciest motorcycle while working as a Domino’s delivery guy, graduating high school against the odds, and learning English from scratch to start a new chapter in the US are just some examples of the goals I had set for myself during my lifetime.

Even though these goals are different, they have some “shared properties”:

  • Tangible & well defined: I knew exactly the price of the motorcycle.
  • Progress can be easily quantified externally: I could show my grades to my mom and she’d be proud of me (usually).
  • More effort is often better: the harder I studied, the better my English became.
  • Path is clear and well understood: I calculated and planned how much money I need to save every month to buy a Yamaha R6 (I still miss you, my dear monster).

Mindfulness Goals

In my new journey, where I try to achieve things like “maintaining a more balanced mental state,” goals have different properties.

  • Intangible: you can’t touch, see, or smell a “thought pattern.”
  • Quantifying is tricky: the only one who can assess your progress is you using your own mind — the same mind that’s often tuned to be judgmental and critical.
  • Patience is more important than dedication: the more you meditate doesn’t necessarily mean the more mindful you become. Ideas like self-compassion and patience play a more critical role.
  • Path is undefined and often never-ending: there are no defined stops on the way to mental stability, and the way towards there is not always a straight line.

The required attitude to achieve mindfulness goals

My western “fight hard” attitude didn’t help me a lot with achieving my new goals. And when you think about it, it kind of makes sense.

The idea of changing thought patterns that have been reinforced and wired in our brains for many years isn’t similar to anything else we have tried to do in our lives — it’s a foreign idea.

So what should we do? Something very foreign and unfamiliar to us as humans who live in the busy modern world: sit still, do nothing, and listen to our breath.

Mindfulness Meditation

Mindfulness meditation is a mental training practice that teaches you to slow down racing thoughts, let go of negativity, and calm both your mind and body. It combines meditation with the practice of mindfulness, which can be defined as a mental state that involves being fully focused on “the now” so you can acknowledge and accept your thoughts, feelings, and sensations without judgment. (from Verywellmind)

I’m not going to write too much on how to meditate since smarter people than me have already written a lot on the subject. I would encourage you to do some reading and to try it out. It’s not rocket science, but it’s definitely the most interesting thing I’ve done in my life.

When we talk about concepts like physical exercise, learning a new language, or even sex, we can find that people experience them in different ways — same thing with meditation. I hope that the approach described above will help you have a healthy and interesting experience.

The Meditation Muscles

I would recommend using Calm to learn the basics of meditation. One interesting analogy, described by narrator Jeff Warren, compares meditation to a workout session, where you train mental muscles.

One muscle group is composed of muscles like focus and clarity, which help understand internal concepts in the mind and body.

The tricky part is that getting deep into yourself and becoming more aware of your thoughts can often lead to stress and anxiety. This is where the second muscle group comes into the picture, with muscles like equanimity, beginner’s mind, and self-compassion.

Training these muscles made it easier for me to walk in the path of tuning my thought patterns.

Pranking your brain and your friends

During my military training, as a cyber security researcher, my prankster mentor gave me an exercise to write a program: when the user hits the “k” button on the keyboard, instead of writing the letter “k”, the computer will write “κ” ( k -> κ). As you can see, these letters look almost the same, but they mean different things when you write code.

To make it more interesting, this behavior would happen inconsistently, based on randomness. The next step was to install this malicious program on my colleague’s computer and watch him freak out when his code failed to run.

Despite the questionable ethical nature of this exercise, while writing the program, I learned a lot about operating systems, particularly about a concept called “Hooks.”

You see, the exercise isn’t very straightforward. When you write a program, it usually runs in “User Space” — this area limits the boundaries of the software, like a sandbox.

On the other hand, the code of your operating system runs in “Kernel Space.” This code defines the “natural” behavior of your computer. For example — “what happens when the user clicks the K button on the keyboard?” and other automatic processes that happen behind the scenes of your computer.

I had to find a way to change processes in the Kernel Space from the User Space. After some googling, I discovered the concept of “Win32 Hooks” — a mechanism that allows you to intercept internal processes in the kernel and change their flow.

Let’s see another example for hooks:

Natural laptop hibernation flow

Manipulate the flow using hooks to make the laptop play a song before going to sleep

Brain Kernel

Our brains are pretty much like advanced computers, right? They also have their kernel space. One process defined in our brain’s kernel is the relationship between thoughts and emotions.

This connection happens unconsciously without our complete control over it.

One of the gifts the mediation can give you is the ability to:

  1. Create some space between thoughts and emotions
  2. Define “hooks” between them and change the flow to go back to your awareness instead of automatically jumping from thoughts to emotions.

Summary & The Sanity Pyramid

My meditation practice allowed me to gain visibility into my mind and better understand my thought patterns. After some practice, I managed to define some hooks that helped me control negative thought patterns.

After two years of practice, I can share that I managed to eliminate a severe negative thought pattern (in retrospect, I understand it was a type of OCD). Other negative thought patterns were mitigated, and some are still around while I try to improve my relationship with them :)

Here is a quick pic of my pyramid of sanity.

If you like the article, please feel free to share it. If I see that people find it interesting, in the following article, I’ll write about how to be mindful of your body and what Charmander has to do with all of it.

Thank you for reading!

--

--

Inon Shkedy

I love to learn, build and break things. Head of Security Research @ Traceable.ai