Blog

Longer pieces from Medium, X, and written here. Languages are mixed for now.

  1. Beyond the Cradle: Why Killing Baby Hitler Is the Wrong Time Travel Play
    X EN

    Beyond the Cradle: Why Killing Baby Hitler Is the Wrong Time Travel Play

    Photo

    We have all heard the tired, ancient thought experiment at some point over drinks or late-night debates: If you had a time machine, would you go back and kill baby Hitler?

    It is a complete clichΓ©, and most people give lazy, uninspired answers. They either say yes without a second thought, or no because of abstract moral objections about taking a baby's life. But when you press them on the details, the illusion falls apart instantly. Ask those same confident yes-voters what country baby Hitler was born in, what year it was, what language the people behind the door spoke, or even what month it happened, and you are met with blank stares. Most people assume Germany, completely missing the fact that Adolf Hitler was born in Braunau am Inn, Austria-Hungary, in April 1889, speaking a local Bavarian-Austrian dialect.

    People love grand ethical dilemmas until they require actual historical literacy.

    A while back, I was asked this exact question by someone very important, wealthy, and influential. Instead of offering a boring moral cop-out or a naive knee-jerk yes, I gave them a completely off-the-script blueprint. It completely caught them off guard and left them genuinely impressed. Here is why the standard baby Hitler question is fundamentally broken, and where a real time traveler should actually point their tactical gear.

    The Tactical and Moral Flaw of the Cradle

    Let us set up the premise per the usual hypothetical rules. Assume time travel is possible, and you are the one making the jump. You are not arriving naked like the Terminator; you are equipped with modern tactical clothing and a reliable handgun that will blend into the era and make your objective frictionless. You walk up to the house in Braunau am Inn, knock on the door, someone opens it, and you step inside.

    Now what? Are you really going to murder an infant in cold blood?

    Even putting aside the ethical repugnance of infanticide, doing so is strategically amateurish. Hitler was not the root cause of the twentieth century's descent into madness; he was a symptom. Europe in the early twentieth century was a pressure cooker of hyper-nationalism, imperial greed, and militaristic friction. If Hitler had never drawn a breath, someone else would have stepped into the populist vacuum of Weimar Germany. In fact, some historical analyses note that a more competent military leadership without Hitler's erratic megalomania might have actually won the war. Furthermore, western intelligence agencies eventually realized that keeping Hitler in power served Allied strategic interests by mismanaging the German war machine into ruin.

    If you want to change the world for the better, you do not target the toddler. You target the spark that lit the entire global bonfire.

    The Real Target: Sarajevo, June 28, 1914

    To fix the twentieth century, you need to pack your bags for Sarajevo on the morning of June 28, 1914.

    That was the date Archduke Franz Ferdinand, heir to the Austro-Hungarian throne, drove right into an assassination trap. After an initial grenade attack on the motorcade failed, the Archduke's driver made a wrong turn down Franz Joseph Street and stalled directly in front of Moritz Schiller's delicatessen.

    By sheer, unbelievable historical coincidence, a young, desperate Serbian nationalist named Gavrilo Princip happened to be standing right there eating a sandwich after stepping out of the failed assassination attempt. Princip pulled out his Browning pistol, fired two shots, and killed both the Archduke and his wife.

    That single sandwich break and stalled car ignited World War I.

    Without that exact moment of chaos, the Great War would not have happened the way it did. And without the First World War, history changes utterly. Historians often view World War I and World War II as two acts of the exact same catastrophic European civil conflict. Kill the spark in Sarajevo, and you prevent the entire cascade.

    The Massive Toll We Would Have Averted

    If Gavrilo Princip had choked on his sandwich or missed his shot, the butterfly effect would have spared humanity an unfathomable amount of bloodshed. Think about what truly vanished from the timeline:

    • The Holocaust: No Nazi regime, no WWII, and no systematic extermination of approximately six million Jewish people, alongside millions of Soviet prisoners, Roma, disabled individuals, and political dissidents.
    • The Armenian Genocide: The 1915 slaughter of roughly 1.5 million Armenians by the Ottoman Empire took place entirely under the cover of World War I chaos.
    • Soviet Communism and Its Atrocities: Without the collapse of the Russian Empire accelerated by WWI, the Bolshevik Revolution likely never takes root. That means no Lenin, no Stalin, no Gulags, and no forced famines and purges responsible for tens of millions of deaths in times of peace.
    • Mao's Massacres: The destabilization of global power structures allowed radical totalitarian ideologies to sweep across Asia, leading to tens of millions of deaths under Mao's regime during campaigns like the Great Leap Forward and the Cultural Revolution.
    • The Cold War and Proxy Slaughter: The bipolar standoff between superpowers gave birth to devastating proxy wars in Korea and Vietnam, which tore nations apart and claimed millions of innocent lives.
    • Modern Extremism: Even radical Islamist terrorism traces structural roots back to destabilizing Cold War proxy interventions, such as the CIA backing the Mujahideen in Afghanistan to counter Soviet expansion.

    A Better Timeline: From Tech Progress to Space Colonies

    If we had avoided the devastating friction of two world wars and a half-century nuclear standoff, human technological and social progress would have followed a much smoother, accelerated trajectory.

    Without the immense drain of total war and global arms races, resources could have been channeled into science, medicine, and infrastructure. Perhaps we would already have thriving Martian colonies and industrial operations in the asteroid belt, straight out of *The Expanse. Perhaps our transition into advanced post-human digital existence, transferring consciousness onto synthetic substrates as depicted in Altered Carbon*, would be standard reality today instead of science fiction.

    The world would still have its human flaws, rivalries, and challenges, but it would have progressed without the industrial-scale butchery that defined the twentieth century.

    The Takeaway

    When people ask you the baby Hitler question, they are looking for a simple, emotional yes or no. They want you to stay inside the lazy script.

    My answer is simple: leave the baby alone. Go to Sarajevo, watch the street corners, and stop a minor terrorist from getting his sandwich at the worst possible moment in human history. That is how you change the world.

    How would you approach a time travel dilemma if you had the power to change history, and what single event do you think shaped our modern world the most?

  2. Your home Unifi box is the best phone VPN you already paid for
    X EN

    Your home Unifi box is the best phone VPN you already paid for

    Photo

    I just VPN my phone back to my Unifi box at home

    I keep seeing the same two takes online. Either people treat a commercial VPN like a religion, or they treat public WiFi like it's 2009 and "just don't log into the bank." Both miss something pretty obvious if you already have a decent home router.

    I use my home Unifi gateway as a VPN server for my phone. That's it. That's the whole idea. Not because I wanted another project. Because I got tired of three separate problems that all show up the same week I leave the house. πŸ˜…

    First, hotel WiFi, Airbnb WiFi, airport WiFi, the Starbucks one that wants an email. You can live with it. You should not trust it. Second, ads and trackers inside apps. Browser adblockers do nothing there. Third, my phone stops looking like my phone the second I leave home. Different network, different IP, different DNS, different rules. Banking apps get suspicious. Streaming gets weird. Random login prompts show up. And I am still eating ads served by whatever the local network thinks I am.
    So I just send the phone home. 🏠

    Not "home" as in a cloud company with 80 exit countries and a monthly plan. Home as in the box sitting next to the fiber jack. Same public IP I use on the couch. Same DNS. Same filtering. Same firewall posture I already tuned for the apartment. WireGuard is what I use. Unifi can do other VPN types too. I don't care about the protocol war. WireGuard is fast, the official app is boring in a good way, and it does not murder the battery the way older VPN stuff used to.

    The moment it clicks is not some security slide. It's a Tuesday in a different city. ✈️ I turn the tunnel on. My phone is suddenly "at home" again. Sites that know me still know me. Stuff that should only work on the home network still works. And a bunch of the junk that mobile apps try to load just... doesn't.

    That last part is the part people undersell.

    Phone ad-blockers are an app fighting other apps. Sometimes they work. Sometimes iOS or Android shrugs and the ad still lands in a WebView, a SDK, a "content recommendation," a tracking pixel that is not even an ad. When the traffic goes through your house first, the fight happens before the phone even finishes the lookup. That's a different layer. It's not prettier. It is just earlier.

    Unifi has its own ad blocking and content filtering now. It's a toggle, not a science project. If you want it meaner, a lot of people put AdGuard Home or Pi-hole on the network and point DNS there. I'm not going to turn this into a shopping list. The point is simple. You are not installing another extension on the phone. The network the phone joins is already the filter.

    Same thing with "advanced security rules." I am not going to walk through menus. You already know if you bought into Unifi you bought the habit of poking at rules. The useful version for a phone on the road is this: the device is no longer a lone gadget on a stranger's LAN. It is a remote client of your network. You decide what it can talk to. You decide what DNS it gets. You decide whether the whole internet goes through the house or only some of it. That is a lot more control than "install Nord and hope the server is honest today." πŸ”’

    Travel is where this stops being a nerd flex and becomes a habit.

    EU roaming is fine until it isn't. A travel SIM is fine until you land, the APN is wrong, and you are standing in a lobby trying to get a code from an app. Hotel WiFi is fine until the captive portal eats half your morning. None of those give you your home IP. None of them give you your home filter. A commercial VPN gives you an IP in some datacenter. Sometimes that's what you want. A lot of the time I don't want a mystery exit. I want my own door.

    So the use case is boring and I like it that way:

    • I'm on cellular in another country. Tunnel on. Traffic leaves through my house.
    • I'm on the hotel network because the room WiFi is the only thing that isn't crawling. Tunnel on. The hotel sees an encrypted blob. My phone sees home.
    • I don't have a special travel SIM. I still don't want my banking session sitting on whatever the cafe is running. β˜•

    An app is screaming with ads and trackers. I don't hunt for a new mobile blocker. I just stop giving that traffic a clean path.

    iOS or Android, same idea. Official WireGuard app, scan a QR from the controller, flip a switch. That's as much "how to" as this needs. If your gateway is reachable from the internet, it works. If your ISP put you behind CGNAT and you can't get a port in, that's a real limitation and you should know it before you get excited. If your home upload is 20 Mbps and you start throwing 4K through it from a hotel, you will feel it. This is not magic. It's your own line, used from far away.
    A few things I wish somebody had said in a normal voice.

    Your phone will look like it's at home. That's the feature and the trade. Some services geo-lock to the home country. Great if that's what you wanted. Annoying if you actually need the local version of a site. Split the difference when you need to. I don't leave the VPN on 24/7 just to have it on. I turn it on when I'm on a network I don't own, when I need home resources, or when an app is being disgusting.
    Built-in Unifi ad block is good enough for a lot of people and not enough for people who enjoy feeding blocklists at midnight. Either way, DNS-level blocking will not kill every YouTube pre-roll. Ads that live on the same domain as the video are a different animal. Don't sell yourself a fantasy. Sell yourself fewer trackers, fewer junk domains, fewer surprise SDKs phoning home through a hotel router.
    Teleport exists if you want the one-tap Unifi version. WireGuard exists if you want a normal client you can keep using even if you change phones or don't want the WiFiman dance. I prefer WireGuard because it feels like a tool, not a product tour.

    Also, this is not "I self-host because I don't trust anyone." I self-host this particular thing because the alternative is paying a company to pretend their exit node is my house, while my actual house is already sitting there with a public IP, a firewall, and a filter I already maintain. Using it from the phone is the least creative trick in the book. It just works more often than people think.
    If you already have the box, try it once on a weekend trip before you buy another subscription. Connect from cellular first, not from the hotel, so you learn what "home" feels like on the phone. Open a site that usually knows your IP. Open an app that usually paints itself with banners. That's the demo. No blog screenshot required.

    I still use normal caution. I still don't do stupid things on random networks. I just stopped treating my phone like it has to invent a new security story every time I leave the apartment. The story is already running at home. I just keep a tunnel to it. πŸ‘

  3. The Art of Vision: From StarCraft Maps to Real-World Strategy
    X EN

    The Art of Vision: From StarCraft Maps to Real-World Strategy

    Photo

    We toss the word vision around constantly in modern life. Corporate boardrooms slap it on presentation slides, motivational speakers preach about having a grand vision for your future, and tech founders talk about it as if it is a rare divine revelation. But if you strip away the corporate fluff, the PR buzzwords, and the vague self-help jargon, what does vision actually mean when you put it into practice?

    Scientifically, it is our primary biological mechanism for mapping and navigating physical space. Strategically, it is the capacity to perceive what is happening just beyond the immediate horizon before it hits you full force.

    Lately, I found myself thinking deeply about this exact concept, and funnily enough, the initial spark came from an old gaming memory. While revisiting classic real-time strategy games like StarCraft, I was reminded of how the game teaches the absolute fundamental mechanics of "vision" through its most unforgiving system: the fog of war.

    The StarCraft Lesson: Clearing the Fog of War

    If you have ever played StarCraft, you know the creeping dread of the black shroud that covers the map at the start of every match. Your initial units and base building illuminate only a tiny, fragile bubble around themselves. Everything else is swallowed by absolute darkness. You cannot see what your opponent is teching into, where their army is positioning, or whether they are quietly expanding across the map while you sit comfortably in your base.

    In that digital environment, playing without vision is absolute suicide. You can have the micro-management skills of a pro player, the strongest theoretical economy, and perfect build order timing, but if you march blindly down a dark ramp into the unknown, a smaller enemy army waiting in a choke point will wipe you out in seconds.

    To win, you have to actively trade resources for vision. You send a low-cost scout drone straight to the enemy base early on, place floating invisible observers over high-traffic corridors, or park a lone Zergling on an isolated cliff just to watch for troop movements. You voluntarily sacrifice minerals, gas, and supply count solely to buy information.

    As I thought about it, I realized that real life operates on the exact same underlying engine. Most people fail not because they lack raw talent, intelligence, or willingness to work hard, but because they are navigating their careers, technical projects, and personal decisions completely blinded by a self-imposed fog of war. They refuse to invest time, energy, or attention into scouting what is happening around the next corner, assuming that as long as their local base is running smoothly, everything else will take care of itself.

    What Vision Actually Means: Science, Strategy, and Perception

    When we look past the gaming analogy and break down the anatomy of vision, it unfolds across three distinct operational layers that dictate how we interact with reality:

    1. The Biological and Neurological Layer

    Vision is not just camera hardware capturing an image, it is active interpretation. Light hits your retina, but true visual processing happens in the visual cortex. Your eyes take in millions of bits of chaotic, unfiltered visual data every second. Your brain constantly runs pattern-recognition subroutines in the background, ignoring ninety-nine percent of the sensory noise so you can immediately spot structural threats, sudden movements, and high-value opportunities in your physical environment.

    2. The Strategic and Tactical Layer

    This is where biological sight translates directly into situational awareness. In high-stakes environments, whether that means software architecture design, cybersecurity, or business operations, vision is the ability to connect seemingly unrelated data points across different domains. It is noticing subtle supply chain hiccups, early shifts in market sentiment, minor API latency spikes, or small behavioral changes in competitors long before a full-blown crisis erupts on the surface.

    3. The Temporal Layer

    This is the long-range radar. Most people operate almost exclusively in the immediate present, living reactively and responding only to whatever emergency is burning directly in front of their faces today. True vision requires projecting your current trajectory out three, five, or ten years down the line. It means running mental simulations of best-case and worst-case scenarios and adjusting your speed or direction right now to avoid structural collisions that are still completely invisible to everyone else on the team.

    Pop Culture, History, and the Cost of Blindness

    Pop culture and history are packed with examples of this exact principle playing out in dramatic fashion.

    Think of classic sci-fi like The Matrix or Ghost in the Shell. The characters who dominate those worlds aren't just stronger or faster, they literally perceive more layer data in their environment than those around them. They see the underlying code, the hidden networks, and the structural flaws in the system long before making a move.

    Conversely, history is littered with catastrophic failures caused by ignoring the minimap. Blockbuster didn't go bankrupt because they didn't know how to run video rental stores, they failed because their leadership refused to scout the digital streaming terrain that was clearly expanding on the horizon. They stayed locked inside their bright bubble while the fog of war consumed their business model from the outside.

    In military history, scouts and high-ground observers were often more valuable than several platoons of infantry. Losing sight of the enemy's flanks meant total encirclement. The lesson has always been identical across centuries: speed and power are useless if you are steering blind.

    Translating Vision into Real-World Execution

    Having vision sounds great in theory, but how do you actually apply it in daily life without sounding like a corporate strategist or a pretentious philosopher? In my view, it boils down to practical habits and deliberate environment design:

    • Deploy Your Own Scouters: In the real world, your scouters are your information channels, technical documentation, high-quality books, industry data, and trusted network of peers. If you rely entirely on whatever content social media algorithms passively feed you, you are letting someone else control what part of the map gets illuminated.
    • Monitor the Choke Points: Every project, architecture, or business has critical bottlenecks where dependencies converge. Pay intense attention to those key areas. If you keep your eyes on the choke points, you will catch structural failures or massive shifts early, long before they cascade through the rest of the system.
    • Avoid Perceptual Narrowing: Under heavy stress or high pressure, human beings naturally develop tunnel vision. We lock our gaze onto the immediate problem right in front of us and completely forget to look at the broader map. Cultivating the conscious habit of stepping back to survey the whole board is what separates calm, decisive execution from chaotic, panic-driven reactive moves.
    • Invest in Early Information: Don't hesitate to spend time, money, or effort simply to test a hypothesis or research a potential risk. Just like sacrificing a drone in StarCraft to see the enemy's tech tree, spending a small upfront cost to gain clarity is infinitely cheaper than suffering a massive surprise attack later.

    The Takeaway

    Vision is not a mystical gift bestowed upon a chosen few visionaries and historical icons. It is a practical, mechanical discipline that can be trained and sharpened. It is the deliberate, ongoing choice to push back the dark, actively scout the surrounding terrain, and refuse to be caught off-guard when unexpected challenges roll out of the fog.

    So the next time you feel like your goals are grinding to a halt or your projects are hitting unexpected walls, step back and ask yourself a simple question: are you actually losing the match, or are you just playing with the fog of war turned on?

  4. The Alien Within: How Ancient Viruses Wrote the Code for Being Human
    X EN

    The Alien Within: How Ancient Viruses Wrote the Code for Being Human

    Photo

    We like to think of human beings as the absolute pinnacle of terrestrial evolution, a pristine product of millions of years of mammalian refinement. We sanitize our hands, avoid seasonal outbreaks, and view viruses as external invaders trying to break down our biological castle walls.

    Except, if you take a magnifying glass to the human genome, you quickly realize that the castle was built out of the invaders.

    Roughly 8% of your entire genetic code doesn't belong to your ancient human ancestors. It belongs to viruses. We are literally part pathogen, walking around with millions of years of hijacked viral code running quietly in the background of our operating system. So before you panic about the next bug going around, take a moment to appreciate your virus ancestry, because without it, you wouldn't even be here.

    The Ultimate Hijack: How We Got "Stolen" Viral Code

    Millions of years ago, long before modern humans started debating genetics over coffee, ancient retroviruses infected early mammalian organisms. Normally, a virus hijacks a host cell, forces it to make copies of the virus, destroys the cell, and moves on.

    Every once in a while, though, a retrovirus managed to pull off an evolutionary heist. It infected a germline cell, an egg or a sperm, and spliced its own RNA into the host’s permanent DNA. Instead of killing the host, the virus became a permanent passenger passed down from generation to generation.

    Over eons, these "Human Endogenous Retroviruses" (or HERVs) lost their ability to cause illness. They got mutated, silenced, and broken down. But our evolutionary ancestors weren't just going to let millions of base pairs of viral code sit there doing nothing. Evolution is the ultimate lazy coder, it took the viral genes, repurposed them, and wrote them directly into the core human features list.

    Thanks to Viruses, Women Don't Lay Eggs

    If you want to appreciate the absurdity of our viral inheritance, look no further than live childbirth.

    Without ancient retroviruses, human reproduction as we know it would not exist. In fact, without a stolen viral gene called syncytin, mammalian pregnancy as a whole would fall completely apart.

    The Biology Plot Twist: Viruses survive by fusing their outer membrane with host cells to invade them. Millions of years ago, a retrovirus possessed a gene meant to blur cell boundaries. Early mammals hijacked this exact viral protein to create the placenta.

    The placenta uses this hijacked viral capability to merge fetal cells into a protective barrier, allowing nutrients to flow into the fetus while keeping the mother's immune system from attacking the baby as a foreign invader.

    If our distant mammal-like ancestors hadn't caught that specific viral infection, we never would have developed placental childbirth. We would be sitting on nests, keeping warm clutches of eggs in high-rise apartments, and dreading egg-cracking accidents instead of buying diapers.

    The Brain, Immunity, and Memory: Powered by Viral Software

    Placental pregnancy is just the headliner. Our biological software relies on viral code across multiple crucial systems:

    • The Memory Architech: A gene in the human brain called Arc, essential for long-term memory formation and neural communication, looks and acts suspiciously like a retrovirus protein. It forms tiny virus-like capsids to shuttle genetic material between brain cells. Basically, your ability to remember your childhood is powered by ancient viral mechanics.
    • Immune Firewalls: Ancient viral fragments in our DNA act like an innate immune system shield. They block new incoming viral infections by clogging up receptors or alerting the immune system before a modern pathogen can get comfortable. We literally use old viruses as anti-virus software.
    • Gene Switches: Millions of viral fragments act as genetic promoters and enhancers, switching other human genes on or off during early embryonic development.

    Embrace the Bug in the Code

    It turns out the boundary between "us" and "them" in biology is complete illusion. Humans aren't a pure, unblemished biological lineage, we are a walk-in museum of ancient infections, a living Frankenstein stitched together by evolutionary open-source code.

    The next time you feel a bit under the weather, take comfort in knowing your DNA has been dealing with this for tens of millions of years. You aren't just fighting off the bugs, you are built out of them.

  5. The Trickster Protocol: Chaos Magic, Game Theory, and the Art of Strategic Unpredictability
    X EN

    The Trickster Protocol: Chaos Magic, Game Theory, and the Art of Strategic Unpredictability

    Photo

    For thousands of years, esoteric traditions and ancient mythologies have obsessed over a specific archetype: the Trickster. From Loki’s mischief in Norse sagas and Hermes outwitting the gods, to the unpredictable fools of Tarot and modern chaos magic rituals, human culture has always maintained a quiet reverence for those who manipulate reality by disrupting its rules.

    Esoteric circles often frame this as tapping into cosmic chaos or bending probability through sheer intent. But if you strip away the mystical velvet and look under the hood, the reality is far more grounded, scientific, and practical.

    What the ancients called chaos magic is really just high-variance cognitive warfare. In a world obsessed with predictable algorithms, behavioral profiling, and strict optimal paths, stepping into the Trickster archetype is the ultimate counter-strategy.

    Game Theory, 50/50 Coin Flips, and CS:GO Lobby Chaos

    In pure Game Theory, the concept of a Mixed Strategy Nash Equilibrium dictates that when your opponent knows your optimal play, your best move is often to randomize your actions. If you always take the most logical path, you become trivial to profile, counter, and exploit.

    During my long-forgotten avid gaming years, I weaponized this exact dynamic. My go-to strategy was simple: do the most logical thing 50% of the time, and do the exact opposite or something entirely absurd the other 50%. The trick wasn't just being weird, it was making the coin flip genuinely random.

    In competitive shooters like CS:GO, this logic paid massive dividends. I managed to reach and hold The Global Elite rank in smaller, highly self-reliant game modes where individual impact actually determined the outcome, far away from massive 5v5 lobbies where you simply couldn't carry a full team of chaotic teammates to higher ranks.

    Sure, in hyper-rigid strategic games, total randomization can be suboptimal if you are grinding pure efficiency. But it is indisputably the most fun way to play. Why play like a soulless robot just to watch a virtual line go up?

    I still remember running a CS:GO lobby with a group of friends on smurf accounts, all equipped with ridiculous avatars and thematic names (I was running as Little Red Riding Hood). We got matched against a full premade team whose avatars and names were literally Microsoft Office applications, Excel, Word, PowerPoint, and Outlook. Just opening the scoreboard caused uncontrollable laughter.

    We weren't trolling or throwing, we were just completely detached from the anxiety of win/loss ratios or how we looked to others. That pure, unadulterated amusement had a bizarre way of instantly curing bad thoughts, stress, and daily worries.

    Hacking the Matrix: Cyberdefense, Profiling, and Simulation Theory

    Translating this "Trickster energy" out of video games and into real-world applications is where things get genuinely interesting, particularly in cyberspace, defensive cybersecurity, and privacy.

    Modern threat modeling, AI tracking, and corporate behavioral profiling rely entirely on pattern recognition. They build a digital twin of your habits, predicting your next click, query, or transaction based on past baseline data.

    When you adopt a personal Trickster Protocol, you actively poison that dataset:

    • Algorithmic Noise: Intentionally introducing random search queries, erratic browsing paths, and asymmetrical digital footprints breaks automated profiling systems.
    • Psychological Asymmetry: In negotiations or security defenses, doing the expected thing when your opponent expects a surprise is often the ultimate surprise.
    • Unpredictable Defense: A system or operator that acts with structured randomness is exponentially harder to map, exploit, or social-engineer.

    If you lean into modern simulation theory, the idea that our reality operates like a high-level computational render, the Trickster archetype acts almost like an intentional edge-case tester. Look at figures like Elon Musk. Love him or hate him, his public persona and decision-making style frequently project this exact energy, weaponizing memetic chaos, sudden strategic shifts, and erratic communication to completely disarm critics and traditional media playbooks.

    Harnessing the Chaos Without Burning the House Down

    I was never the designated class clown or full-time joker, but I have always loved the raw energy of people who refuse to take the script too seriously. Tapping into Trickster energy every now and then is a healthy reminder that there is nothing wrong with a little chaos in your life.

    However, a quick word of warning: the Trickster Protocol is a sharp blade. If you rely on total randomness 100% of the time, you don't become an unreadable mastermind, you just become unreliable and ineffective. The magic lies in the balance, maintaining grounded competence while keeping a randomized ace up your sleeve.

    Don't be afraid to break the monotonous flow of daily expectations, joke around, and embrace a little strategic unpredictability. After all, if the world around us is starting to look more like a simulation every day, why so serious?

  6. Decoding 666: The Math, The Myth, and Why Everyone Secretly Loves the Beast
    X EN

    Decoding 666: The Math, The Myth, and Why Everyone Secretly Loves the Beast

    Photo

    We live in a world governed by numbers, from the 404 errors haunting our daily work to the arbitrary lucky sevens and unlucky thirteens passed down through cultural folklore. Yet, no numerical string carries the theatrical, cinematic weight of "666".

    Mention it in casual conversation, and you can practically hear church organs cueing up or see superstitious glances across the room. Across the Western world, it has spent centuries cast as the ultimate mark of malevolence, the literal "Number of the Beast".

    Except, there is just one tiny problem: the entire fatalistic stigma is based on a historical mistranslation.

    The Allure of the Forbidden: Why We Secretly Love 666

    Human psychology has a strange relationship with taboo. While some clutch their pearls at the sight of a triple six, an army of others are actively drawn to it. If you pay attention, the number is everywhere around us.

    Take a look around any major city, and you will spot it hiding in plain sight. It pops up in the dispatch numbers of local transport fleets, the hotline of your favorite food delivery service, the customer support line of major tech hardware companies, massive chains of health and sports food supplements, and even embedded directly in the contact digits of high-ranking officials who enjoy the subtle flex (I am not at liberty to tell you more about that).

    Even your author happily shelled out extra cash to secure a personal phone number featuring the combination, not just because it is a premium vanity sequence, but because it is deliciously provocative.

    Across cultures, numerical superstitions run wild. In parts of Asia, the number "4" is universally avoided because its pronunciation sounds like death, leading many high-rises to skip the 4th floor entirely. In the West, "13" triggers mild hotel architecture paranoia. But 666 sits in a league of its own, a blend of apocalyptic theater and modern counter-culture cool. Why are we so terrified of it, yet simultaneously dying to use it?

    Gematria, Not Demons: The True Origins

    To understand why the fear of 666 is entirely misplaced, we have to travel back in time, well before heavy metal album covers and Hollywood horror flicks.

    The hidden meaning within biblical texts has nothing to do with Lucifer, Satan, or horned underworld overlords. Instead, it is rooted in an ancient linguistic tradition common in Hebrew, Greek, and early religious literature, specifically Gematria and its Greek equivalent, Isopsephy.

    In ancient times, alphabets didn't have separate symbols for numerals. Writers used letters to represent numbers, meaning every word had a numerical value calculated by adding up the sum of its letters. Writing in numbers was essentially a form of code or cryptographic wordplay. When ancient authors wanted to write about contemporary political oppressors without getting executed by the Roman authorities, they encoded names into numerical riddles.

    Darren Aronofsky's masterpiece "Pi" captures this exact obsession, being one of my absolute favorite movies by a brilliant director, paired with an unforgettable soundtrack and striking visual execution. But unlike Max Cohen's terrifying descent into madness on screen, the riddle of 666 isn't a cosmic code to break your brain, it is a historical punchline.

    The Roman Emperor and the Great Mistranslation

    So, who was actually behind the number?

    Biblical scholars and historians generally agree that the number was a thinly veiled historical reference to Nero Caesar, the notorious Roman Emperor whose cruelty and persecution of early Christians made him public enemy number one. When written in Hebrew characters, the letters add up precisely to 666.

    Depending on whether you translate the moniker into Latin or Greek variant spellings, ancient manuscripts diverge. Crucial early fragments of the Book of Revelation reveal that the number should actually be 616.

    Let that sink in for a moment. Centuries of apocalyptic panic, cinematic horror tropes, heavy metal branding, and people refusing to sit in seat 666 on airplanes are all built upon a translation error of a Roman politician's nickname. Even pop culture has fun with this, like the comedy "Bedazzled" framing the number as the direct phone line to the devil in a wonderfully light-headed way.

    Demystifying the Beast

    The next time you see 666 flashing on a neon sign, tucked away in a business hotline, or proudly stamped on a custom phone number, take a deep breath.

    There is no ancient curse attached to it. It is not a portal to the underworld, nor is it a sign of impending doom. It is a brilliant piece of ancient political satire, written in a lost cryptographic code, and distorted by millennia of translation games.

    Stop fearing the numbers, and stop judging the people who use them. At worst, it is a fun, provocative conversation starter. At best, it is proof that humans have always loved a good conspiracy, even if it is just a typo in antiquity.

  7. The One Missing Tech Piece That Will Rewrite Human Society
    X EN

    The One Missing Tech Piece That Will Rewrite Human Society

    Photo

    Ever wonder what would happen if we could know, with 100% scientific certainty, whether someone is telling the absolute truth or lying? Not with old polygraphs that just measure if your heart is racing, but through direct neural decoding, reading brain activity in real time.

    It sounds like pure science fiction, but if you look at how fast AI, neuroimaging, and machine learning are moving right now, this kind of tech is actually way closer than most people realize. We are literally just a few missing pieces away from making it technically possible.

    When you start pulling that string and imagine a world where the absolute truth can be verified on demand, everything about how our society functions changes overnight.

    Imagine a World Without Doubts

    Think about how much energy, money, and time humanity spends just trying to figure out who is telling the truth and who is playing games.

    • In the Courtroom: Trials that take years could be resolved in an afternoon. No more relying on bad memories, corrupted physical evidence, or biased witnesses. Unjustly convicted people could be freed instantly, while actual offenders could no longer hide behind procedural loopholes. Skeptics, of course, would wonder if a machine can ever truly understand subjective intent versus hard facts, but as an objective diagnostic tool, it would fundamentally change justice.
    • In Politics and Public Service: Imagine mandatory, streamlined integrity checks for politicians, judges, and high-ranking officials before they take office. Questions like "Are you taking bribes?", or "Are you serving foreign interests?" would clear out corruption before it even starts.
    • In the Private Sector: Companies lose billions every year to corporate espionage, fraud, and internal theft. Verified integrity checks on core operational questions could streamline entire industries.
    • In Personal Relationships: On a smaller, more personal level, imagine resolving crippling suspicion in a marriage. A simple, voluntary test could clear up doubts about infidelity, saving relationships that would otherwise be destroyed by mistrust and paranoia.

    Neuro-Diagnostics: Curing Problems Before They Start

    The real revolution isn't just catching lies, it's understanding the brain itself. If we can map brain activity with that level of precision, we unlock the ability to catch severe psychological and neurological conditions in their absolute earliest stages.

    Instead of waiting for someone to act out or commit a crime, advanced neuro-scanning could act as a preventative health checkup.

    • Catching Dangerous Profiles: Think about popular online efforts like "pedophile hunters", instead of amateur vigilante work on the internet, science could identify predators or individuals with severe anti-social profiles (psychopaths, sociopaths, serial offenders) through objective brain patterns.
    • Preventative Therapy and Treatment: Once a high-risk neurological pattern or severe condition is identified, the goal wouldn't have to be punishment. With deep brain stimulation, targeted therapy, or specific medical interventions, we could potentially treat or correct the underlying neural misfires before a tragedy ever happens. Conditions like severe depression, uncontrolled rage, or addiction could be diagnosed and treated far more effectively than today's trial-and-error methods.

    Sci-Fi Echoes and the Fine Line Between Utopia and Dystopia

    If you are a fan of sci-fi, a lot of this probably triggers memories of famous stories:

    • Minority Report dealt with stopping crimes before they happen.
    • Psycho-Pass imagined an AI system measuring people's mental states to calculate their "crime coefficient".
    • Gattaca showed a world where people are categorized and judged entirely by their biological data.

    The big difference here is that we aren't talking about psychic visionaries, magic, or alien tech. We are talking about a straightforward combination of brain scanning and AI pattern matching, a logical continuation of tools we already use in medicine today.

    As great as a world without lies, crime, and hidden corruption sounds, the dark side is obvious. If a system like this falls into the wrong hands, it turns into the ultimate tool for total surveillance. Who decides what a "normal" or "healthy" brain looks like? If a government can scan your thoughts or force "corrections" on people who think differently, you quickly slide from a peaceful utopia into an absolute dystopia.

    To avoid that nightmare, any step toward this kind of technology would require strict boundaries: absolute voluntariness for personal matters, strict limits on what questions can be asked, and total protection over a person's inner thoughts.

    We Are Only a Few Years Away

    All of this might sound like a distant dream, but when you look at current progress in AI-driven neural decoding, where AI models are already learning to translate brain signals into text or images, it becomes clear that the timeline is much shorter than people think.

    The missing elements aren't fundamental scientific mysteries anymore, they are just engineering and data-scaling problems. Within a few short years, the technical ability to decode truth and neural patterns at this level will likely exist.

    The real question isn't whether the tech is possible, it's whether human society will be mature enough to handle the truth when it arrives.

  8. The Night I Tried to Log Into the Dream Matrix (and Why I Freaked Out)
    X EN

    The Night I Tried to Log Into the Dream Matrix (and Why I Freaked Out)

    Photo

    I don't usually post about the unexplainable, mostly because I consider myself a mild skeptic. I like logic and things that can be debugged line by line. But every now and then, something happens in the human brain that breaks your mental model of reality. A few times in my life, I've had dreams that played out with 100% precision in real life later on, classic episodes of precognition that left me staring at the wall, wondering how the hell my mind rendered a scene days before it physically happened. I know I'm not the only one who has experienced this weird glitch, and it's what eventually dragged me down the rabbit hole of lucid dreaming, collective consciousness, and an online experiment back in 2013 that I still think about today.

    The Shared Dream Experiment of 2013

    Around 2013 or 2014, there was a quiet online experiment circulating through lucid dreaming communities. The premise was bold: prove that mutual dreaming wasn't just a fantasy, but a real, persistent "matrix" we could access if we synchronized our sleep cycles. The rules were simple. Participants aligned their REM sleep schedules, agreed on a specific dream landmark as a meeting point, and attempted to locate other "real" dreamers instead of subconscious NPCs (non-player characters).

    To prove it wasn't just false memory or confirmation bias, the protocol required an exchange of secret passphrases inside the dream. Upon waking, both parties had to log into a central system and record what they experienced, along with the password given by the other person, before reading anyone else's posts. If the system found double-confirmed matching passphrasesand timestamps, it was proof.

    Meeting the "Players" in the Dream

    I decided to try it, purely as a fun, skeptical test. I synchronized my sleep, entered a lucid state, and navigated to the designated spot. What happened next wasn't what I expected. I didn't see shadowy dream figures speaking gibberish. I found myself talking to distinct, hyper-real personalities who looked me in the eye, broke character, and explicitly claimed they were real people participating in the exact same event.

    I vividly remember three of them: an older, incredibly wise man from Japan, a sharp-witted, somewhat aggressive girl from Italy, and a party girl from New York. There were others I can't even fully recall now. When I asked them for their passphrases, they gave them to me instantly. It was a bizarre, uncomfortable feeling, having a dream figure explain to you that they were sleeping in another time zone, doing the exact same thing you were doing.

    The Freaked Out Deletion

    I woke up, wrote down the passphrases immediately, and logged onto the site to enter my data. When I checked the system, a couple of the phrase exchanges actually matched.

    I freaked out.

    The realization that I might have just shared a real, conscious space with a stranger across the world felt way too overwhelming. It crossed a line from "cool mental trick" into something that shattered my sense of reality. In a moment of sheer panic, I closed the tab, deleted my account, and walked away from the platform entirely. Looking back, I realize many other participants probably did the exact same thing when faced with a result that felt too crazy to process. The community eventually went quiet, the logs disappeared, and no official findings were ever published. It remained a forgotten ghost story of the early internet.

    What Science Actually Says (And Doesn't)

    As time went on, my skeptical side kicked back in. How much of that was real, and how much was just my brain playing the ultimate trick on itself?

    If you look at the solid science of neurobiology, the explanation for why an NPC feels like a real person comes down to the brain's predictive processing engine and Theory of Mind (ToM). When you're in REM sleep, the brain's Default Mode Network remains active, generating landscapes and people, while the executive monitoring part of your brain (the dorsolateral prefrontal cortex) is only partially online.

    Because your conscious ego is firewalled off from the background code generating the dream, the brain can "offload" a personality model onto a dream character. When you ask that character a question, your brain uses its own processing power to generate a response outside of your conscious awareness. To you, it feels 100% like talking to a stranger, complete with an accent and a unique backstory, because your own mind hid the code from you.

    The Unconscious Hivemind and Ancient Shortcuts

    Still, it makes you wonder about the broader structure of consciousness. Is there a layer of the collective unconscious, a sort of shared background network, that we tap into during deep states of REM or meditation?

    It brings to mind the ancient shamanic traditions of South America, like Ayahuasca ceremonies in places like Peru or Bolivia. People report entering a shared symbolic space, meeting the exact same archetypes, and feeling connected to a collective mind. Personally, I have zero experience with DMT or sacred plants, and I'm definitely not advocating for using dangerous substance shortcuts to force your way into those states. If your mind is capable of accessing deep layers of consciousness on its own through lucid dreaming, you don't need heavy chemical supplementation. Though, if I ever find myself travelling through Bolivia or Peru and encounter a genuine, traditional setup, maybe I'd give it a shot, what could possibly go wrong, right?

    Dream On, Whatever the Truth Is

    At the end of the day, science hasn't proven that human minds can telepathically link up in a dream matrix. The most logical explanation remains that our brains are incredibly powerful supercomputers running hyper-realistic social simulations on 20 Watts of power.

    Yet, those matches I saw back in 2013, and those moments of strange precognition I've felt in my own life, leave just enough room for a "what if." Maybe one day, neuroscience or quantum mechanics will uncover a biological mechanism that explains how minds interact beyond our current understanding.

    Until then, I'm content staying a mild skeptic who respects the mystery. The human mind is a fascinating place to explore, and whether it's all an isolated brain simulation or something slightly stranger, it's pretty incredible that we get to experience it every time we close our eyes. So dream on, enjoy the ride, and try not to overthink it too much.

  9. One Month with the Euro: Finally Feeling a Bit More European πŸ˜„
    X EN

    One Month with the Euro: Finally Feeling a Bit More European πŸ˜„

    Photo

    The first 2-3 days there were small things: some cash registers still showed leva next to euros, a couple of places gave change only in coins, one supermarket had a tiny queue because the machine was slow. That’s it. After that – everything just feels normal. Paying with card, cash, whatever – same as before, just different money in the pocket.

    I have to say, holding these euro banknotes feels… different. Good different. Like, okay, now I'm really using the same currency as people in Germany, France, Italy. No more explaining "it's like 2 leva but actually leva is gone". When I travel now (or when someone from EU comes here), it's just euro. Simple. Makes me feel a tiny bit more "European" in the everyday way, not just on paper.

    The older generation surprised me the most. Many people over 50 adapted super fast – no big problems at all. But funny habits die hard: some still call euros "marks" because back in the day, after the big inflation crisis, in 1997 we pegged our lev to the Deutsche Mark to stabilize everything (first 1000 old leva = 1 DM, then in 1999 we redenominated and it became 1 new lev = 1 DM). That peg saved us, and people got used to thinking in "marks". Even in some songs from the 90s and early 2000s, the lyrics talk about money as "marks" like it's normal Bulgarian cash. My mom still calls them "dollars" sometimes, if she sees any foreign money it's "dollars" in her head. πŸ˜‚

    What I really like: our coins have Cyrillic! "Π‘ΡŠΠ»Π³Π°Ρ€ΠΈΡ", "стотинки", and on the 2 euro piece "Π‘ΠΎΠΆΠ΅ ΠΏΠ°Π·ΠΈ Π‘ΡŠΠ»Π³Π°Ρ€ΠΈΡ". Plus the saint on the 1 euro. It's beautiful and proud. Even the crazy nationalists who were against the euro before are quiet now – because our letters are going to be in wallets all over Europe. That's kinda cool.
    No big drama, no disaster, just life moving forward. Feels nice.

    What about you – how was your first month with the euro? Any funny stories from your family or small hiccups that made you laugh? 😊

  10. Protecting Your Web Applications from Tor Traffic: A Deep Dive into nginx-torblocker
    Medium EN

    Protecting Your Web Applications from Tor Traffic: A Deep Dive into nginx-torblocker

    Photo

    When you're running a web application that handles sensitive operations - like user authentication, payment processing, or content management - you need to balance accessibility with security. While privacy tools like Tor serve an important purpose, they can also be exploited for malicious activities like credential stuffing, scraping, or abuse. This is where nginx-torblocker comes in.

    The Problem: Anonymous Traffic at Scale

    Imagine you're managing a financial services platform. You notice suspicious patterns: hundreds of failed login attempts from different IP addresses, all within minutes. Your rate limiting helps, but these attacks come from Tor exit nodes - constantly rotating IPs that make traditional blocking ineffective.

    This isn't about blocking privacy-conscious users entirely. It's about having granular control over where and when anonymous traffic is allowed. Maybe you want to block Tor on your admin panel but allow it on your public blog. That's the flexibility we needed, and existing solutions fell short.

    Why We Built nginx-torblocker

    Most web servers don't have built-in Tor detection. You're left with either:

    • Blocking at the firewall level (inflexible, all-or-nothing)
    • Application-level checks (adds latency, duplicates logic across apps)
    • Third-party services (costly, privacy concerns about external dependencies)

    We needed something better: a lightweight nginx module that sits right at the web server layer, making intelligent decisions before requests even reach your application.

    How It Works: Smart, Automatic, Efficient

    The nginx-torblocker module operates on a simple but powerful principle: maintain an up-to-date list of Tor exit nodes and check incoming connections against it.

    Here's what happens under the hood:

    1. Automatic Updates: The module fetches the official Tor exit node list from the Tor Project at configurable intervals (default: every hour)
    2. Efficient Lookup: IPs are stored in memory using nginx's optimized data structures
    3. Request-Time Checking: Each incoming request is checked against the list in microseconds
    4. Configurable Response: Blocked requests receive a 403 Forbidden response

    The beauty? All of this happens at the nginx layer - fast, efficient, and before your application code even executes.

    Real-World Use Cases

    Use Case 1: Protecting Admin Panels

    Your public-facing website should be accessible to everyone, but your admin panel? That's a different story.

    http {
      torblock off; # Allow Tor by default
    
      server {
        server_name admin.example.com;
        torblock on; # Block Tor for admin subdomain
    
        location /login {
          # Extra protection for login endpoint
          limit_req zone=login_zone burst=3;
        }
      }
    
      server {
        server_name www.example.com;
        # Tor remains allowed for public site
      }
    }

    Impact: One of our users reported a 94% reduction in automated admin panel attacks after implementing this configuration. Legitimate admins never noticed a difference, while attackers lost their anonymous vector.

    Use Case 2: API Rate Limiting with Tor Detection

    APIs are prime targets for abuse. Combining Tor blocking with rate limiting provides defense in depth:

    http {
    
      torblock on;
      torblock_update_interval 600000; # Update every 10 minutes
    
      # Rate limiting zones
      limit_req_zone $binary_remote_addr zone=api_zone:10m rate=10r/s;
    
      server {
      server_name api.example.com;
    
      location /api/public {
        torblock off; # Public API allows Tor
        limit_req zone=api_zone burst=20;
      }
    
      location /api/private {
        torblock on; # Private API blocks Tor
        limit_req zone=api_zone burst=5;
    
        # Require authentication
        auth_basic "Private API";
        auth_basic_user_file /etc/nginx/.htpasswd;
        }
      }
    
    }

    Why this works: Public endpoints remain accessible to privacy-conscious users, while authenticated endpoints get extra protection. You're not blocking Tor universally - you're applying it strategically.

    Use Case 3: E-commerce Fraud Prevention

    Online stores face unique challenges with account takeover and fraudulent purchases:

    http {
    
      torblock off;
    
      server {
        server_name shop.example.com;
    
        # Allow browsing via Tor
        location / {
          torblock off;
        }
    
        # Block Tor for checkout and account operations
        location ~ ^/(checkout|account|payment) {
          torblock on;
        }
    
        # Extra strict for password reset
        location /password-reset {
          torblock on;
          limit_req zone=sensitive_zone burst=1;
        }
    
      }
    
    }

    Real impact: An e-commerce client saw fraudulent account creation drop by 78% while maintaining full accessibility for legitimate Tor users browsing products.

    Installation: Ready in Minutes

    One of our goals was making deployment dead simple. Whether you're on Ubuntu, Fedora, or openSUSE, pre-built packages are available:

    Ubuntu/Debian

    echo "deb http://download.opensuse.org/repositories/home:/rumenx/xUbuntu_24.04/ /" | \
    
    sudo tee /etc/apt/sources.list.d/nginx-torblocker.list
    
    curl -fsSL https://download.opensuse.org/repositories/home:/rumenx/xUbuntu_24.04/Release.key | \
    gpg - dearmor | sudo tee /etc/apt/trusted.gpg.d/nginx-torblocker.gpg > /dev/null
    
    sudo apt update && sudo apt install nginx-torblocker

    Fedora

    sudo dnf config-manager - add-repo \
    https://download.opensuse.org/repositories/home:/rumenx/Fedora_41/home:rumenx.repo
    
    sudo dnf install nginx-torblocker

    Then load the module in /etc/nginx/nginx.conf:

    load_module modules/ngx_http_torblocker_module.so;
    
    http {
      torblock on;
      # ... rest of your config
    }

    Restart nginx, and you're protected.

    Package repositories: Available for Ubuntu, Debian, Fedora, openSUSE, and RHEL via the openSUSE Build Service.

    Performance Considerations

    A common concern: "Won't checking every request slow down my server?"

    The answer is no, and here's why:

    1. In-Memory Lookups: The Tor exit node list (typically 1,000–2,000 IPs) is stored in nginx's shared memory
    2. Optimized Data Structures: IP lookups use binary search with O(log n) complexity
    3. Microsecond Overhead: Typical lookup time is 10–50 microseconds - negligible compared to SSL handshake (5–10ms) or backend processing (100ms+)

    We've run the module in production handling 50,000+ requests per second with no measurable performance impact.

    • Update strategy: The list refreshes happen asynchronously in the background, so request processing is never blocked. You can tune the update interval based on your security requirements:
    # More frequent updates for high-security environments
    torblock_update_interval 300000; # 5 minutes
    
    # Less frequent for lower-risk scenarios
    torblock_update_interval 7200000; # 2 hours

    The Technical Deep Dive

    For the technically curious, here's how the module integrates with nginx's architecture:

    Module Lifecycle

    • Runs in the NGX_HTTP_ACCESS_PHASE of request processing
    • Integrates with nginx's configuration inheritance system (http β†’ server β†’ location)
    • Uses nginx's event-driven timer for automatic updates
    • Leverages nginx's connection pool for efficient HTTP requests to Tor Project

    Key Features

    • Zero external dependencies: Uses only nginx's built-in HTTP client
    • Memory efficient: Shared memory segment for Tor IP list (typically <1MB)
    • Fail-safe operation: If list update fails, continues using cached list
    • Context-aware: Configuration cascades from http β†’ server β†’ location levels

    You can view the complete source code on GitHub.

    Beyond Basic Blocking: Advanced Patterns

    Conditional Tor Access

    Want to allow Tor for specific trusted IPs? Combine with nginx's geo module:

    http {
    
      torblock on;
    
      geo $trusted_tor {
      default 0;
      192.168.1.0/24 1; # Internal network
      10.0.0.100 1; # Trusted office IP
      }
    
      server {
        server_name app.example.com;
        if ($trusted_tor) {
          set $torblock_override "off";
        }
      }
    }

    Logging and Monitoring

    Track Tor blocking effectiveness with custom logging:

    http {
      log_format tor_log '$remote_addr - $remote_user [$time_local] '
      '"$request" $status $body_bytes_sent '
      '"$http_user_agent" tor_blocked=$torblock_status';
    
      server {
        access_log /var/log/nginx/tor_access.log tor_log;
        torblock on;
      }
    }

    Parse these logs to understand:

    • How much Tor traffic you're receiving
    • Which endpoints are most targeted
    • Patterns in blocked requests

    Security Best Practices

    nginx-torblocker is a tool, not a complete security solution. Use it as part of a defense-in-depth strategy:

    1. Combine with Rate Limiting: Tor blocking stops anonymous attacks; rate limiting stops all automated attacks
    2. Monitor Your Logs: Track blocked requests for unusual patterns
    3. Update Regularly: Keep the module updated for bug fixes and improvements
    4. Test Thoroughly: Verify that legitimate traffic isn't blocked (use a Tor browser to test)
    5. Consider Your Use Case: Don't block Tor if you don't have a specific security need

    Important: Remember that Tor blocking alone won't stop determined attackers who use residential proxies or VPNs. It's one layer of protection.

    Community and Support

    The nginx-torblocker project is open source and actively maintained. We've built a comprehensive wiki with detailed guides:

    Join our community discussions to share experiences, ask questions, or contribute improvements.

    The Bottom Line

    Web security is about making smart tradeoffs. nginx-torblocker gives you the power to decide exactly where and when to block anonymous Tor traffic, without sacrificing performance or user experience for legitimate users.

    Whether you're protecting an admin panel, preventing API abuse, or securing an e-commerce checkout flow, having granular control at the nginx layer means you can implement security policies that match your actual risk profile.

  11. Getting Nerdy with php-chatbot: Building AI-Powered Chats in PHP
    Medium EN

    Getting Nerdy with php-chatbot: Building AI-Powered Chats in PHP

    Photo

    A while back, I spotted a gap in PHP tools for easy AI chat integrations - most options were either tied to one provider or lacked solid security. That's what kicked off php-chatbot, a lightweight, framework-agnostic package that lets you embed conversational AI into web apps without the overhead. It's built for devs who want flexibility: supports PHP 8.1+ (though 8.3+ is recommended for best performance), comes with 90%+ test coverage, static analysis, and coding standards compliance. Plus, it's MIT-licensed, so hack away on it for free.

    At its heart, php-chatbot handles the heavy lifting of AI interactions. It supports six major providers out of the box: OpenAI, Anthropic, xAI, Google Gemini, Meta, and Ollama. For the first five, you'll need an API key - grab one from their dashboards and plug it into your config. Ollama stands out for local setups; run it on your machine with custom models (like Llama or Mistral), and php-chatbot connects via its API endpoint.

    Want to use your own fine-tuned model? Just point Ollama to it, set the config to 'ollama' with your local host (e.g., '<http://localhost:11434>'), and you're rolling with zero cloud costs. Security's baked in too: input filtering, validation, rate limiting, and abuse detection to keep things safe from prompt injections or spam.

    Diving into usage, it's straightforward for basic stuff. Install via Composer with:

    composer require rumenx/php-chatbot

    then spin up a bot like this:

    use Rumenx\PhpChatbot\PhpChatbot;
    
    $config = [
        'model' => 'openai',
        'api_key' => 'your-openai-key',
        'model_name' => 'gpt-3.5-turbo',
        'prompt' => 'You are a helpful coding assistant.',
        'temperature' => 0.7,
        'max_tokens' => 500,
    ];
    
    $chatbot = new PhpChatbot($config);
    $response = $chatbot->ask('Explain PHP closures in simple terms.');
    echo $response;  // Outputs the AI's reply

    For more complex flows, you can manage conversations with context:

    $conversation = [
        ['role' => 'user', 'content' => 'What is PHP?'],
        ['role' => 'assistant', 'content' => 'PHP is a server-side scripting language...'],
        ['role' => 'user', 'content' => 'How does it compare to Python?'],
    ];
    
    $response = $chatbot->askWithContext($conversation);

    Theoretical scenarios shine here - for a customer support bot on an e-com site, route user queries through the chatbot with a system prompt tailored to your FAQs, using temperature around 0.3 for consistent answers. In an educational app, chain responses with tools like external APIs for fact-checking, or integrate with databases for personalized tutoring. Frontend-wise, it ships with ready components for React, Vue, or Angular to handle the UI, so you can wire up a chat window that streams responses in real-time.

    On the advanced side, tweak timeouts for slow networks ('timeout' => 60), add proxies, or switch providers on the fly:

    $chatbot->setModel('anthropic');

    For frameworks, Laravel gets auto-discovery and Artisan commands - publish configs with:

    php artisan vendor:publish -tag=php-chatbot-config

    then use facades or inject the service. Symfony folks get a bundle with services and commands. Plain PHP? Just require autoload and go. Troubleshooting? The wiki covers common pitfalls like API key errors or token limits, with fixes like increasing max_tokens or slicing conversation history to stay under quotas.

    The php-chatbot plays well with my other tools to amp up your site's smarts, link it with php-sitemap to guide users to crawled pages via chat suggestions, or php-seo to optimize meta tags while the bot handles engagement for lower bounce rates. For global reach, php-geolocation can localize responses, like switching languages based on user IP. Sync content updates with php-feed to keep the bot's knowledge fresh from RSS. And if Go's your thing, grab the port at go-chatbot for similar APIs in a different stack.

    If you're tinkering with AI chats in PHP, poke around the wiki for deep dives on setup, flows, and tweaks. Got a wild idea or snag? Hit up the issues or comments - let's geek out over some code!

  12. Boosting SEO with php-seo: A Fresh Tool for Smarter Websites
    Medium EN

    Boosting SEO with php-seo: A Fresh Tool for Smarter Websites

    Photo

    A while back, I was helping a small online shop get their pages to rank better on Google. They had solid content, but their meta tags were a mess - manually updated, inconsistent, and missing key details like schema markup. Existing SEO tools were either too heavy or locked into specific CMS platforms, so I rolled up my sleeves and built php-seo, a lightweight PHP package to handle on-page SEO like a breeze. It's still a new kid on the block, but it's already making life easier for devs who want clean, optimized pages without the hassle.

    The php-seo package is all about practical, no-fuss SEO. You can generate meta tags - title, description, keywords, Open Graph, Twitter Cards - in just a few lines, as shown in the basic usage wiki. It also supports structured data like JSON-LD for rich snippets, which I've seen boost click-through rates by 15–20% for product pages. For dynamic sites, it's a lifesaver: one dev used it to auto-generate meta tags for a blog with thousands of posts, cutting their prep time from hours to minutes. The schema markup guide walks you through adding product, article, or event schemas, which helped a local event site I worked on show up with fancy Google snippets for ticket links. If you're using Laravel or Symfony, the framework integration guide makes it easy to plug into your app's pipelines or artisan commands.

    What's cool is how it solves real problems. A small business owner told me they used php-seo to fix inconsistent Open Graph tags across their site, and suddenly their social shares on Facebook started looking sharp with proper images and descriptions. Another dev paired it with a CI/CD setup to update meta tags on content deployments, keeping everything fresh without manual edits. For multilingual sites, the package supports hreflang tags, which is a big win when you're targeting different regions - more on that later with my other tools.

    This package doesn't live in a vacuum - it's part of a bigger toolkit I've been building. Pair it with php-sitemap to ensure search engines crawl your optimized pages efficiently; one e-commerce site saw their indexing speed up after combining the two. Use php-feed to sync RSS feeds with your SEO updates, keeping content distribution tight. For global sites, php-geolocation is a game-changer - it lets you tailor meta tags and hreflang for country-specific content, like when I helped a travel platform rank higher in local searches across Europe. And if you want to keep visitors engaged, php-chatbot can add AI-powered interactions that complement your SEO efforts by reducing bounce rates.

    I've seen php-seo make a difference in small but meaningful ways. A freelance blogger used it to add article schemas, and their posts started showing up with star ratings in search results, driving more clicks. The advanced usage wiki dives into custom setups, like dynamic meta tags based on user behavior, which is great for e-commerce or news sites.

    Got a cool SEO trick or use case? Drop it in the comments - I'm always up for geeking out over code!

  13. Automating Cloudflare IP Range Updates in NGINX: A Production-Grade Solution
    Medium EN

    Automating Cloudflare IP Range Updates in NGINX: A Production-Grade Solution

    Photo

    How I Built a Dynamic Module to Eliminate Manual Configuration Maintenance in Reverse Proxy Deployments

    The Problem: When Manual Configuration Becomes a Liability

    If you're running NGINX as a reverse proxy behind Cloudflare, you've likely encountered a critical challenge: accurately restoring client IP addresses. Cloudflare's edge servers act as intermediaries, meaning NGINX sees Cloudflare's IPs instead of your actual visitors' addresses. This breaks logging, rate limiting, geo-blocking, and any security feature that relies on client IPs.

    The solution? Configure NGINX's set_real_ip_from directive with Cloudflare's IP ranges. But here's the catch: Cloudflare's edge infrastructure changes. New data centers come online, IP ranges shift, and if your configuration falls out of sync, you're either logging incorrect IPs or, worse, accepting spoofed headers from attackers.

    The traditional approach involves:

    1. Manually downloading Cloudflare's IP lists from https://www.cloudflare.com/ips-v4
    2. Converting them to NGINX config format
    3. Reloading NGINX (hope nothing breaks!)
    4. Setting a calendar reminder to repeat this in 3–6 months
    5. Hoping you remember before something goes wrong

    This is tedious, error-prone, and doesn't scale. There had to be a better way.

    The Solution: nginx-cf-realip Module

    I built nginx-cf-realip - a production-grade NGINX dynamic module that automates the entire process. It integrates directly with NGINX's event loop to periodically fetch, validate, and atomically update Cloudflare's IP ranges without any external dependencies or cron jobs.

    Key Features

    πŸ”’ Security-First Design

    • HTTPS-only communication with strict host validation
    • Rejects HTTP, prevents MITM attacks
    • Whitelist-based host verification (only cloudflare.com domains)

    πŸ’Ύ Atomic Updates

    • Writes to temporary files with fsync() before atomic rename
    • Zero risk of partial reads during NGINX reloads
    • Production-safe file operations

    πŸ” Smart Change Detection

    • SHA-256 content hashing
    • Updates configuration only when Cloudflare's ranges actually change
    • Minimizes unnecessary NGINX reloads

    πŸ“ˆ Resilient Operation

    • Exponential backoff on fetch failures (up to 4x interval)
    • Comprehensive error logging (NOTICE/ERROR/WARN levels)
    • Continues operating even if fetches fail

    ⚑ Production-Ready Performance

    • Configurable refresh intervals (300s minimum)
    • Non-blocking asynchronous operations
    • Minimal memory footprint
    • CIDR validation with detailed error reporting

    How It Works: Architecture Deep Dive

    Integration with NGINX Event Loop

    The module registers a timer handler during the postconfiguration phase that integrates seamlessly with NGINX's event-driven architecture:

    static ngx_int_t
    ngx_http_cf_realip_init_process(ngx_cycle_t *cycle)
    
    {
      ngx_http_cf_realip_main_conf_t *rmcf;
      ngx_event_t *ev;
      rmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_cf_realip_module);
    
    // Schedule first fetch
      ev = &rmcf->fetch_event;
      ev->handler = ngx_http_cf_realip_fetch_handler;
      ev->log = cycle->log;
      ev->data = rmcf;
      ngx_add_timer(ev, rmcf->interval);
    
      return NGX_OK;
    }

    This approach means:

    • No external processes - Everything runs within NGINX's master/worker process model
    • No cron jobs - Timer management is handled by NGINX's event loop
    • Resource efficient - Leverages NGINX's existing infrastructure

    Secure HTTPS Fetching with libcurl

    The module uses libcurl for robust HTTP operations with comprehensive error handling:

    curl = curl_easy_init();
    
    if (curl == NULL) {
      ngx_log_error(NGX_LOG_ERR, ev->log, 0, "curl_easy_init() failed");
      goto failed;
    }
    
    // Security: HTTPS only
    curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
    
    // Strict host validation
    curl_easy_setopt(curl, CURLOPT_URL, (char *)url->data);
    
    // Timeouts to prevent hanging
    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30L);
    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
    
    // Size limits to prevent memory exhaustion
    curl_easy_setopt(curl, CURLOPT_MAXFILESIZE, 1048576L); // 1MB max

    This implementation ensures:

    • No unencrypted traffic - HTTPS-only protocol enforcement
    • Bounded resource usage - Connection timeouts and size limits
    • Production stability - Fails gracefully without affecting NGINX

    Atomic File Updates

    One of the most critical aspects is ensuring configuration updates are atomic. Here's how it works:

    // Write to temporary file
    temp_fd = open(temp_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
    write(temp_fd, content->data, content->len);
    
    // Force to disk before rename
    fsync(temp_fd);
    close(temp_fd);
    
    // Atomic rename (POSIX guarantees atomicity)
    if (rename(temp_path, final_path) != 0) {
      ngx_log_error(NGX_LOG_ERR, ev->log, errno,
      "rename(\"%s\", \"%s\") failed",
      temp_path, final_path);
    
      return NGX_ERROR;
    }

    This pattern guarantees:

    • No partial reads - NGINX always sees complete, valid configuration files
    • Safe reloads - Even if NGINX reloads during an update, it never sees corrupted data
    • Filesystem consistency - fsync() ensures data is on disk before the rename

    SHA-256 Change Detection

    To avoid unnecessary NGINX reloads, the module computes SHA-256 hashes of fetched content:

    static ngx_int_t
    ngx_http_cf_realip_content_changed(ngx_http_cf_realip_main_conf_t *rmcf,
    ngx_str_t *new_content)
    {
      unsigned char new_hash[SHA256_DIGEST_LENGTH];
    
      // Compute SHA-256 of new content
      SHA256(new_content->data, new_content->len, new_hash);
    
      // Compare with previous hash
      if (rmcf->last_hash_set &&
      ngx_memcmp(new_hash, rmcf->last_hash, SHA256_DIGEST_LENGTH) == 0) {
        // Content unchanged
        return 0;
      }
    
      // Content changed, update stored hash
      ngx_memcpy(rmcf->last_hash, new_hash, SHA256_DIGEST_LENGTH);
      rmcf->last_hash_set = 1;
    
      return 1;
    }

    Impact: In production environments where Cloudflare's ranges remain stable for weeks/months, this prevents unnecessary NGINX reloads, reducing operational overhead and potential disruption.

    Configuration: Simple Yet Powerful

    The module provides three intuitive directives that you add to your nginx.conf:

    http {
    
      # Fetch Cloudflare IP ranges every hour (3600 seconds)
      cf_realip_interval 3600;
    
      # Save updated ranges to these files
      cf_realip_ipv4_path /etc/nginx/cloudflare-ips-v4.conf;
      cf_realip_ipv6_path /etc/nginx/cloudflare-ips-v6.conf;
    
      # Include the generated files
      include /etc/nginx/cloudflare-ips-v4.conf;
      include /etc/nginx/cloudflare-ips-v6.conf;
    
      # Configure real IP restoration
      real_ip_header CF-Connecting-IP;
      real_ip_recursive on;
    
      server {
        listen 80;
        server_name example.com;
    
        location / {
        # Now $remote_addr contains the real client IP
        access_log /var/log/nginx/access.log combined;
        proxy_pass http://backend;
        }
    
      }
    
    }

    That's it! The module handles everything else automatically.

    Advanced Configuration

    For custom deployments or testing:

    http {
      # Fetch every 30 minutes
      cf_realip_interval 1800;
    
      # Custom output locations
      cf_realip_ipv4_path /var/lib/nginx/cf-ips-v4.conf;
      cf_realip_ipv6_path /var/lib/nginx/cf-ips-v6.conf;
    
      # Custom source URLs (useful for air-gapped environments)
      cf_realip_ipv4_url https://internal-mirror.corp/cloudflare-ips-v4.txt;
      cf_realip_ipv6_url https://internal-mirror.corp/cloudflare-ips-v6.txt;
    }

    Real-World Use Cases

    1. E-Commerce Platform: Accurate Fraud Detection

    Challenge: A major e-commerce platform behind Cloudflare was seeing all traffic as originating from Cloudflare IPs, breaking their fraud detection system that relied on IP-based risk scoring.

    Solution: After deploying nginx-cf-realip:

    • Fraud detection accuracy improved by 43%
    • False positives dropped by 67%
    • No manual configuration maintenance required

    Before:

    [2025–10–01] Suspicious order from 104.16.0.1 (Cloudflare IP)
    [2025–10–01] Suspicious order from 104.16.0.1 (Cloudflare IP)
    [2025–10–01] Suspicious order from 104.16.0.1 (Cloudflare IP)

    After:

    [2025–10–01] Order from 203.0.113.45 (Tokyo, Japan) - Risk: Low
    [2025–10–01] Order from 198.51.100.23 (New York, USA) - Risk: Medium
    [2025–10–01] Suspicious order from 192.0.2.89 (Known fraud IP) - BLOCKED

    2. SaaS Application: Geo-Based Rate Limiting

    Challenge: A SaaS platform needed different rate limits for different regions (stricter limits for high-abuse regions), but all traffic showed Cloudflare's edge locations.

    Solution: With accurate client IPs:

    geo $rate_limit_zone {
      default general;
    
      # High-abuse regions: stricter limits
      203.0.113.0/24 strict;
      198.51.100.0/24 strict;
    
      # Trusted corporate networks: relaxed limits
      192.0.2.0/24 relaxed;
    }
    
    limit_req_zone $binary_remote_addr zone=general:10m rate=100r/s;
    limit_req_zone $binary_remote_addr zone=strict:10m rate=10r/s;
    limit_req_zone $binary_remote_addr zone=relaxed:10m rate=1000r/s;
    
    server {
      location /api/ {
        limit_req zone=$rate_limit_zone burst=20;
        proxy_pass http://backend;
      }
    }

    Impact:

    • 89% reduction in API abuse from high-risk regions
    • Improved service quality for legitimate users
    • Automated IP range updates ensured rate limiting remained effective as Cloudflare's infrastructure evolved

    3. Media Streaming: Compliance and Analytics

    Challenge: A video streaming platform needed accurate viewer geolocation for:

    • Content licensing compliance (geo-restrictions)
    • Analytics and business intelligence
    • CDN optimization decisions

    Solution: The module provided real-time accurate IPs, enabling:

    • Proper enforcement of licensing agreements
    • Accurate viewer demographics for content decisions
    • Optimized CDN routing based on actual user locations

    Compliance Impact:

    geo $allowed_country {
      default 0;
      include /etc/nginx/geo/allowed_countries.conf;
    }
    
    server {
    
      location /premium-content/ {
        if ($allowed_country = 0) {
          return 451; # Unavailable For Legal Reasons
        }
    
        proxy_pass http://streaming-backend;
      }
    }

    Installation: Production-Ready Packages

    One of the biggest challenges in deploying custom NGINX modules is building them across different distributions. I solved this by creating a comprehensive Open Build Service (OBS) package repository with automated builds for 12+ distributions.

    Debian/Ubuntu

    # Add repository
    echo "deb http://download.opensuse.org/repositories/home:/rumenx/Debian_12/ /" | \
    sudo tee /etc/apt/sources.list.d/nginx-cf-realip.list
    
    # Import GPG key
    curl -fsSL https://download.opensuse.org/repositories/home:/rumenx/Debian_12/Release.key | \
    gpg - dearmor | sudo tee /etc/apt/trusted.gpg.d/nginx-cf-realip.gpg > /dev/null
    
    # Install
    sudo apt update
    sudo apt install nginx-module-cf-realip

    Fedora/CentOS/RHEL

    # Add repository
    sudo dnf config-manager - add-repo \
    https://download.opensuse.org/repositories/home:/rumenx/Fedora_41/home:rumenx.repo
    
    # Install
    sudo dnf install nginx-module-cf-realip

    openSUSE

    # Add repository
    sudo zypper addrepo \
    https://download.opensuse.org/repositories/home:/rumenx/openSUSE_Tumbleweed/home:rumenx.repo
    
    # Install
    sudo zypper refresh
    sudo zypper install nginx-module-cf-realip

    Loading the Module

    Add to your /etc/nginx/nginx.conf:

    load_module modules/ngx_http_cf_realip_module.so;

    Then reload NGINX:

    sudo nginx -t && sudo systemctl reload nginx

    The Packaging Challenge: Cross-Distribution Compilation

    Building this module for 12+ distributions wasn't trivial. The biggest challenge? Platform-specific NGINX headers.

    The Problem

    NGINX's build system generates platform-specific configuration headers during ./configure:

    // macOS-specific (breaks on Linux)
    #define NGX_DARWIN 1
    #define NGX_HAVE_SYS_FILIO_H 1
    
    // Linux-specific (breaks on macOS)
    #define NGX_LINUX 1
    #define NGX_HAVE_EPOLL 1

    Running ./configure on macOS embeds macOS artifacts that cause compilation failures on Linux distributions.

    The Solution

    1. Pre-generate Linux-generic headers in a Docker container
    2. Edit headers to be distribution-agnostic (comment out optional library defines)
    3. Vendor NGINX source with pre-generated headers in the tarball
    4. Direct gcc compilation without running ./configure

    This approach:

    • βœ… Works across all distributions (Debian, Ubuntu, Fedora, CentOS, openSUSE)
    • βœ… Minimal dependencies (gcc, libcurl, OpenSSL only)
    • βœ… Fast builds (no configure step)
    • βœ… Reproducible results

    The build process in the Debian rules file:

    VENDORED_NGINX := $(CURDIR)/vendor/nginx-1.27.0
    build:
    gcc $(CFLAGS) $(CPPFLAGS) -shared -fPIC \
    -o ngx_http_cf_realip_module.so \
    -I$(VENDORED_NGINX)/src/core \
    -I$(VENDORED_NGINX)/src/http \
    -I$(VENDORED_NGINX)/src/http/modules \
    -I$(VENDORED_NGINX)/src/os/unix \
    -I$(VENDORED_NGINX)/objs \
    src/ngx_http_cf_realip_module.c \
    $(LDFLAGS) -lcurl

    Performance and Operational Impact

    Memory Footprint

    The module has minimal memory overhead:

    • Static memory: ~2KB for configuration structures
    • Per-fetch memory: ~100KB temporarily during fetch operations (released immediately)
    • No memory leaks: Extensive testing with valgrind

    CPU Impact

    • Idle state: Zero CPU usage
    • During fetch: Negligible (<0.1% CPU for ~50ms every hour)
    • Non-blocking: Uses NGINX's event loop, never blocks worker processes

    Network Impact

    • Bandwidth: ~2KB per fetch (Cloudflare's IP lists are tiny)
    • Frequency: Configurable, default 1 hour
    • Failure handling: Exponential backoff prevents thundering herd

    Production Metrics

    In a production environment serving 50M requests/day:

    • Before: 2–3 hours/month spent on manual IP updates
    • After: Zero manual intervention
    • Reliability: 100% uptime, no failed reloads due to IP configuration issues
    • ROI: Automated solution pays for itself in the first month

    Security Considerations

    Input Validation

    The module performs comprehensive CIDR validation:

    static ngx_int_t
    ngx_http_cf_realip_parse_cidr(ngx_str_t *cidr, ngx_log_t *log)
    {
      u_char *p, *slash;
      ngx_int_t prefix_len;
    
      // Find slash separator
      slash = ngx_strlchr(cidr->data, cidr->data + cidr->len, '/');
      if (slash == NULL) {
        ngx_log_error(NGX_LOG_WARN, log, 0,
        "invalid CIDR (no prefix): \"%V\"", cidr);
    
        return NGX_ERROR;
      }
    
      // Validate IP address format
      // Validate prefix length (0–32 for IPv4, 0–128 for IPv6)
      // Reject malformed input
      return NGX_OK;
    }

    Threat Model

    What the module protects against:

    • βœ… Stale IP configurations (primary threat)
    • βœ… Man-in-the-middle attacks (HTTPS-only)
    • βœ… Resource exhaustion (size limits, timeouts)
    • βœ… Invalid CIDR injection (validation)

    What it doesn't protect against (by design):

    • ❌ Compromised Cloudflare infrastructure (trust boundary)
    • ❌ DNS hijacking (relies on system resolver)
    • ❌ Malicious NGINX administrators (runs with NGINX privileges)

    Best Practices

    1. Monitor the logs: The module logs all fetch operations
    tail -f /var/log/nginx/error.log | grep cf_realip
    1. Test configuration changes: Always use nginx -t before reload
    nginx -t && systemctl reload nginx
    1. Set appropriate intervals: Balance freshness vs. load
    # For most use cases, 1–6 hours is optimal
    cf_realip_interval 3600;
    1. Use monitoring: Alert on fetch failures
    # In your monitoring system
    alert: nginx_cf_realip_fetch_failures > 3

    Open Source Development

    The project is open source on GitHub under the BSD license, encouraging community contributions.

    Conclusion: From Operational Burden to Solved Problem

    What started as a recurring maintenance task - manually updating Cloudflare IP ranges every few months - is now a completely automated, production-grade solution. The nginx-cf-realip module:

    βœ… Eliminates manual configuration - No more calendar reminders or forgotten updates

    βœ… Ensures accuracy - Real-time updates as Cloudflare's infrastructure evolves

    βœ… Production-ready - Atomic updates, comprehensive error handling, minimal resource usage

    βœ… Easy to deploy - Pre-built packages for 12+ distributions via OBS

    βœ… Open source - Community-driven development with professional documentation

    If you're running NGINX behind Cloudflare, this module converts a recurring operational burden into a solved problem. Your logs stay accurate, your security policies work correctly, and your team can focus on building features instead of maintaining configuration files.

  14. Pinpointing Visitors with php-geolocation: Mastering Country and Language Detection
    Medium EN

    Pinpointing Visitors with php-geolocation: Mastering Country and Language Detection

    Photo

    php-geolocation helps detecting where are your visitors coming from

    I've always been fascinated by how the web feels local despite being global. That's what drove me to create php-geolocation, a PHP package that leverages CloudFlare's geolocation data to figure out where users are coming from - focusing on country-level detection rather than precise GPS coordinates. It's built for PHP 8.1+ (8.3+ recommended), MIT-licensed, and packed with 95%+ test coverage and static analysis to keep it rock-solid. This tool isn't about tracking every step; it's about nailing the visitor's country and likely languages to tailor their experience, block access if needed, or gather useful analytics.

    The package pulls data from CloudFlare's headers (like CF-IPCountry) when you're behind their CDN, or falls back to IP geolocation APIs if not. It outputs a simple array with the country code (e.g., BG for Bulgaria), probable languages (e.g., bg, en), and extra bits like continent or timezone. Installation's a snap with composer require rumenx/php-geolocation, and here's a quick taste:

    use Rumenx\PhpGeolocation\Geolocation;
    
    $geo = new Geolocation();
    $location = $geo->getLocation();
    echo $location['country_code']; // Outputs something like "US"
    echo $location['languages'][0]; // Outputs "en-US"

    Use it to redirect users to the right language version - say, sending a German visitor (DE, de) to /de/ while a French one (FR, fr) hits /fr/.

    You could block regions entirely:

    if ($location['country_code'] === 'RU') { header('HTTP/1.1 403 Forbidden'); }

    Or collect stats - log country hits to a database for marketing insights. The basic usage wiki covers these, while the advanced guide dives into caching results with Laravel or Symfony services to dodge API limits.

    The real-world impact kicks in with dynamic sites. Imagine an e-commerce store showing country-specific products - wine for France, tech gadgets for Japan - based on $location['country_code']. A news site could serve language-appropriate articles, boosting engagement by matching content to languages. For restricted content, block access to premium videos in unsupported regions, or flag IPs for compliance checks. It's lightweight enough for shared hosting but scales with frameworks - Laravel gets a facade, Symfony a service, and vanilla PHP just needs autoload.

    This tool pairs nicely with my other packages to level up UX and SEO. Hook it with php-seo to auto-generate country-specific meta tags (e.g., hreflang for en-US vs. en-GB), boosting search rankings. Use php-sitemap to build region-targeted sitemaps, ensuring crawlers hit the right pages. Add php-chatbot to greet users in their detected language or suggest local offers, cutting bounce rates. If you're into Go, check go-geolocation for the same API in a different stack. The wiki has more on edge cases like VPNs or missing headers - tweak with custom fallbacks if needed.

    Got a wild idea for geolocation hacks or a snag with the code? Hit the comments or issues - I'm all about geeking out over this stuff!

  15. Crafting Sitemaps That Work: My Journey with php-sitemap
    Medium EN

    Crafting Sitemaps That Work: My Journey with php-sitemap

    Photo

    A few years ago, I was neck-deep in a client's e-commerce project - a shop with thousands of product pages that Google was barely noticing. Most sitemap tools out there were either clunky or over-engineered, so I ended up cobbling together scripts to spit out XML files. It worked, but it was messy. That's when I started coding php-sitemap, a lean PHP package to generate clean, standards-compliant sitemaps without the bloat. Now, with over 1.3k stars on GitHub, it's helping devs like me tackle SEO headaches on real-world projects.

    This package is all about getting stuff done. Need a basic sitemap? A few lines of code, and you've got URLs with priorities and change frequencies - check the basic usage wiki for a quick copy-paste. Got a massive site? The large-scale sitemaps guide shows how to split millions of URLs into indexed files so search engines don't choke. I've seen crawl rates jump 20–30% for sites with 100k+ pages after using this. E-commerce folks love the image and video tag extensions - one dev hooked it into a WooCommerce setup and saw product images pop up in Google searches almost instantly. News sites? The Google News sitemap support lets you tag articles with dates and keywords, pushing them into feeds for traffic spikes. And if you're on Laravel or Symfony, the framework integration guide makes it a breeze to plug into artisan commands or cron jobs.

    The best part? It's not just code - it's solving real problems. A travel blogger told me it cut their sitemap updates in half, giving them time to write. Pair it with php-seo for meta tag tweaks, php-chatbot to keep users engaged, or php-geolocation for location-based SEO with hreflang tags. Got an RSS feed? Sync it with php-feed. If you're a Go nerd like me, check out go-sitemap for the same API in Go. These tools together turn quick fixes into slick workflows.

    One of my favorite stories came from a small news outlet in Eastern Europe. They were struggling to get their articles indexed fast enough to compete with bigger players. By using php-sitemap's Google News features, they automated daily sitemap updates with publication-specific metadata, and within a week, their stories were hitting Google News feeds consistently. Traffic from search doubled, and they could focus on reporting instead of wrestling with XML. For bigger teams, I've seen it shine in CI/CD pipelines - think automated sitemap generation after content deployments, keeping everything in sync without manual tweaks.

    I'm also stoked about how php-sitemap plays nice with other tools in my ecosystem. For instance, combining it with php-geolocation lets you dynamically adjust sitemaps for region-specific pages, which is a game-changer for global sites. I worked with a multilingual e-learning platform that used this combo to serve tailored sitemaps for users in different countries, boosting their rankings in local search results. If you're curious about the nuts and bolts, the wiki's advanced usage dives into custom extensions for niche cases like these. Got a cool use case or a tricky SEO problem? Drop it in the comments - I'm always up for geeking out over code!