Government services aren't company, and some do develop technology, place like US national institute of Health, or US NASA, or US department of Energy come to my mind, but any first world nation would have tons of similar things. As usual doesn't mean there is no bullshit to deal with (You know the saying about reserarcher main job is to look for fundings)
Then there is FOSS sofware some of them being managed by non profit who can afford to pay their developers
finally, there is a whole non profit/charity/coop part of the economy, and considering the weigh of technology, you may have some jobs linked to technology. (But managing let's say the "red cross ERP" sounds as awful as managing any other corporate ERP)
The 20 days detention for westerners aren't usual (while they are for others) but being stopped at immigration because they think you may work is unfortunately standard. If your lucky, they'll search your laptop as good old corporate espionage if you're not, you'll fly home with a denied stamp on your passport