Donald Trump is not used to only being the fifth-richest person in the room, but the then president-elect was grinning nonetheless. Seated with him, at a huge table on the 25th floor of Trump Tower, was the cream of the United States technology industry: the 13 bosses in the room included Google's co-founder Larry Page, Amazon boss Jeff Bezos and Apple chief executive Tim Cook.
For the Silicon Valley elite, it was a moment of humility. California had voted by two-to-one in favour of Hillary Clinton and in San Francisco's tech cluster that ratio was undoubtedly higher. Many of the chief executives around the table had criticised Trump (if mostly in private), and he had given as good as he got. At rallies on the campaign trail he had railed against the technology industry for stealing jobs, promised to launch an antitrust investigation into Amazon and said he would force Apple to make its "damn computers" in the US.
The sight of those chief executives kissing the ring at the summit in December was almost reminiscent of a defeated army swallowing a peace treaty. The photographers in attendance could not fail to capture the grimaces and pursed lips of Cook, Bezos and Facebook's Sheryl Sandberg. Nonetheless, the meeting appeared to mark a thawing in relations. Trump effusively praised the tech industry and said he would do all he could to ensure its success.
Soon after, Oracle's chief executive Safra Catz joined Trump's transition team. Elon Musk and Travis Kalanick, the heads of Tesla and Uber respectively, signed up to his business advisory council. As the inauguration approached, technology executives began to talk about coming to terms with the election result, even acknowledging that tech had been partly responsible for the swell of disenfranchised workers that propelled Trump to power. Companies like Amazon announced plans to hire thousands of new workers in the US.
Technology firms hit back
But then came the inauguration, and soon after, the executive orders. Trump had promised widespread immigration controls in the run-up to the election, but many were shocked at the abrupt travel ban he signed just seven days after becoming president. He had appeared to seek a more conciliatory tone since and Peter Thiel, the PayPal billionaire who is a rare Trump supporter among the tech elite, had spread the message that Trump was to be taken seriously, but not literally.
Last month's order, which froze entry to residents of seven largely-Muslim countries, prompted a furious backlash last weekend.
Technology executives tripped over themselves to deride the ban. Their comments ranged from the measured - Facebook founder Mark Zuckerberg said he was "concerned" and Apple's Cook said it was "not a policy we support" - to the aggravated. Reed Hastings, the founder of Netflix, said that "Trump's actions are hurting Netflix employees around the world, and are so un-American it pains us all." Google's co-founder Sergey Brin joined hundreds in protesting at San Francisco airport. "I'm here because I'm a refugee," he told a reporter.
On Monday, the words turned to action, when Microsoft and Amazon took legal action against Trump's order, throwing their weight behind a challenge from Washington state. Cook added that Apple could follow, and would at least press the White House hard on the matter. The ban had few supporters across corporate America, but in the pro-immigration, jetsetting and naturally-optimistic tech world, it was anathema. Many dotcom bosses, including Google's Sundar Pichai and Microsoft's Satya Nadella, are immigrants. Silicon Valley's most famous icon, Steve Jobs, was the biological son of a refugee from Syria - one of the seven countries on Trump's blacklist. Outside the boardroom, thousands of programmers come from abroad.
Given the outcry among staff, tech companies knew they could not stay silent about the ban. But equally, there were fears that a shaky rapport with the new administration was at risk. Donald Trump is a man who works on deals and relationships, after all.
After the drama of the last week, it may appear that tech companies are in for a particularly rough ride over the next four years. In comparison to Barack Obama, who embraced the use of social media in campaigning and sought the approval of Silicon Valley, Trump appears to have little time for technology (aside from a penchant for tweeting from his smartphone, he is said to rarely use a computer).
The upside for Silicon Valley
But there is an alternative school of thought that a Trump presidency could well be an unexpected boost for the industry, should they be able to swallow their pride to embrace it.
The biggest opportunity for several tech giants is the very real prospect of a tax holiday, which will bring trillions of dollars back to the US. Of the estimated $2.6 trillion (£2.1 trillion) that American companies have stashed offshore, the biggest piles of cash are held by tech companies. Apple, Google's parent company Alphabet, Cisco, Oracle and Microsoft - have more than $500bn (£400bn) parked offshore between them.
Almost half of that is Apple's alone. For years the company has booked sales from Europe and elsewhere in Ireland in anticipation of a tax holiday that has been a long time coming. Apple revealed last week that it has $230bn, 94pc of the company's entire cash reserves, abroad. Investors salivate at the prospect of a bonanza cash return via dividends or share buybacks, while large acquisitions could also be on the table.
Currently, repatriating cash to the US imposes a punitive 35pc tax rate. A tax holiday for America's corporates has been on the table for years, but tensions between Obama's White House and a Republican Congress scuppered any prospect of a deal. Now, with Republicans running all branches of the US government, progress seems more likely. Trump has pledged to cut the 35pc to 10pc
Progress could also help defuse a turbulent battle between Apple and the European Union, which has said the company is avoiding billions of taxes thanks to a sweetheart deal with the Irish government. Were Apple to pay taxes on bringing the cash back home, the EU's argument that it is avoiding them would hold less weight.
Apple is not the only one in Brussels' crosshairs. The European Commission has also charged Google with abusing its dominance on three separate fronts and Facebook with misleading regulators over its $19bn acquisition of WhatsApp. The consistency with which Europe's competition commissioner Margrethe Vestager has targeted Silicon Valley groups has led many inside them to claim that the charges are politically motivated.
A defiant, protectionist president fond of dealmaking could well lend increased support to the companies on the international stage, not only in Europe but in China, where many of the biggest internet companies have been shut out by censorship laws, despite Chinese tech groups enjoying the freedom of New York's financial markets.
The stock market's "Trump bump" also bodes well for a flurry of potential tech IPOs. Snap Inc, the company behind the messaging app Snapchat, is preparing for a flotation that could value it at as much as $25bn. If it proves successful, others such as Dropbox and Spotify are likely to follow. The US markets were starved of tech listings last year. The S&P 500's 7pc rise since the election, driven by the promise of more infrastructure spending and tax cuts, could prove a welcome catalyst. A bonfire of red tape, meanwhile, could boost start-ups, whose numbers are falling.
To exploit the potential benefits of the Trump phenomenon, though, will force America's tech bosses to tread a razor-thin line. Being seen to cosy up to the organisation will play poorly with many employees, not to mention customers: Uber faced a boycott last week when it appeared to undermine a taxi strike during an anti-Trump protest, with anger compounded by Kalanick's position on Trump's business council. The outcry led to Kalanick leaving the role on Thursday.
Walking a fine line
Any windfall from bringing cash home, however, may come with strings attached. While companies may see buybacks and dividends as the obvious use for their overseas holdings, the Trump administration has different ideas: it is likely to push for tech groups to put their freed-up funds into hiring US workers.
Internet companies may well find their day-to-day operations more difficult. The Snowden revelations of 2013 exposed the bulk surveillance carried out by US intelligence services and the extent towards which tech companies must co-operate. The leaks rocked trust in internet groups, but the new regime, which has made security a priority, could introduce measures that expand surveillance at the expense of privacy: Trump publicly criticised Apple over its refusal to decrypt an iPhone belonging to a dead terrorist last year.
The tech industry is often accused of playing fast and loose on privacy. Appearing to collaborate with spooks could spark a mainstream backlash.
Of all of Silicon Valley's famous names, the one that might have the most to gain from Donald Trump's presidency is Twitter, from which the president fires off constant missives. "It's definitely been fascinating to learn from," Twitter's founder Jack Dorsey said at a recent conference. But when asked about how he feels about the new leader of the free world, one word summed it up: "Complicated".