In every corner of the Egyptian capital, a bustling city of 18 million that rarely sleeps, people are locked up in their homes at night under a military-imposed curfew that has driven people up the walls, sometimes literally.

To kill time, one said he spent the night counting flowers on his wallpaper — a staggering 865. Another tested how many cucumbers he can fit in a refrigerator drawer. A third calculated the speed of an ant crawling on his balcony rail.

The curfew has been a shock to Cairo, a city where cafes stay packed into the night and parents routinely take their children out for dinners nearing midnight. The two-week-old military-backed government’s curfew, after violent unrest following the July 3 coup that ousted President Mohammed Morsi, slashed the typical Cairo 24-hour life to just 13 hours.

Forced to close early, businesses and restaurants are hurting in a city where nightlife is a key source of income. The city’s metro system reportedly loses $71,500 a day.

So how have people handled what some online have referred to as “British boarding school hell?”

A few have defiantly attempted to break the curfew, dodging the abundant police and military checkpoints on major highways and overpasses. They have organized underground slumber parties, publicized among friends via social media and mass text messages.

One cafe in the upscale neighborhood of Zamalek even opened for the first time less than two weeks ago and almost all its business has come after curfew hours. On a recent night, tables were full of people smoking shishas, the water pipe tobacco.

“The first few days we were conforming to the curfew, but then people demanded we stay open later and so we did,” said manager Mohammed, who asked his last name and the name of the cafe not be published to avoid reprisals. “People are just not used to sitting at home or adhering (to rules).”

Four students at the cafe studied for a marketing exam for their summer course.

“Before the curfew I am home. After the curfew I go out,” said Mahmoud Emam, 20, as he and his friends laughed.

Others chose to flee the heat and turmoil in Cairo to the Mediterranean coastline, where the curfew doesn’t exist. Weddings, also typically held close to midnight with parties lasting until dawn, have been postponed.

Many find it a challenge to fill the time.

Some predicted a baby boom next winter. Cynics suggest a hike in divorce rates — spouses are locked up together for longer hours.

The Arabic Twitter hashtag “discoveries of the curfew” has become a way for some to vent their frustration. One man discovered that his refrigerator drawer can take 78 lemons or 65 cucumbers standing upright, or 75 if laid horizontally. Another mused that he has found 33 positions to sleep at night and 12 different ways to hug a pillow.

“Boredom is the devil. It makes you do things that you can never imagine,” a young Egyptian on a popular online video says. The humorous short, filmed in a distorted view, includes his cry: “Mr. President, how long can we go on like this?”

“We are turning into toothpaste tubes because of how much we are stuffing our face with food,” he says.

Some offered more blunt discoveries: One female activist declared she’s only now realized it’s been three years since she’s had a job.

This is the second government-called curfew in Cairo since Egypt’s 2011 uprising against autocratic leader Hosni Mubarak. The army first tried it in 2011 but hundreds of thousands held their ground in Tahrir Square, demanding Mubarak step down.

This time, however, has seen widespread compliance. Part of that comes from fear, as more than 1,000 people had been killed across Egypt in recent violence. Others view it as a stand with the military against the country’s ousted president and the Muslim Brotherhood, blamed by the government for inciting much of the unrest.

But even those who acquiesce to the early evening lockdown are sometimes caught in traffic gridlock as the curfew starts. Soldiers have generally been forgiving, but in some cases have stopped drivers by the side of the road until the curfew ends at 6 a.m. Soldiers also shot a journalist to death at a checkpoint in one incident, increasing public fears.

Those watching television at home at night also find themselves exposed to pro-military and anti-Brotherhood comments in programming, with commercials showing Egyptian soldiers running across deserts with rifles and helicopters flying in the sky. Others broadcast scenes of violence from the recent unrest. Television stations sympathetic to the Brotherhood have been taken off the air.

Army leader Gen. Abdel-Fattah “El-Sissi is imposing the curfew to make us all sit at home and watch TV propaganda aimed to make us all love him and hate terrorists,” said Tarek Shalaby, who runs The Planet, an agency that creates and develops websites.

In defiance of the curfew, the Planet has hosted a cooking night, a movie screening and a seminar on how to create web pages during curfew hours. On peak evenings, two dozen people attended. Other activists organized pot-banging sessions at the peak of the curfew to protest both the military and the Brotherhood.

As the curfew drags on, some worry a culture of fear is returning to a nation that prides itself in having rebelled against authority after years of repression.

Tarik Salama has proudly posted his findings online of places open after curfew, including a quiet garden and poolside restaurants at two different hotels. He plans to celebrate his 56th birthday this month during curfew hours to make a statement.

“The curfew is not for security reasons,” Salama said. “It is purely to make people feel that the army is in charge, for psychological reasons.”