103 stories
·
2 followers

Git PSA: git-rev-parse

1 Comment

Another public service announcement about Git.

There are a number of commands everyone learns when they first start out using Git. And there are some that almost nobody learns right away, but that should be the first thing you learn once you get comfortable using Git day to day.

One of these has the uninteresting-sounding name git-rev-parse. Git has a bewildering variety of notations for referring to commits and other objects. If you type something like origin/master~3, which commit is that? git-rev-parse is your window into Git's understanding of names:

  % git rev-parse origin/master~3
  37f2bc78b3041541bb4021d2326c5fe35cbb5fbb

A pretty frequent question is: How do I find out the commit ID of the current HEAD? And the answer is:

   % git rev-parse HEAD
   2536fdd82332846953128e6e785fbe7f717e117a

or if you want it abbreviated:

   % git rev-parse --short HEAD
   2536fdd

But more important than the command itself is the manual for the command. Whether you expect to use this command, you should read its manual. Because every command uses Git's bewildering variety of notations, and that manual is where the notations are completely documented.

When you use a ref name like master, Git finds it in .git/refs/heads/master, but when you use origin/master, Git finds it in .git/refs/remotes/origin/master, and when you use HEAD Git finds it in .git/HEAD. Why the difference? The git-rev-parse manual explains what Git is doing here.

Did you know that if you have an annoying long branch name like origin/martin/f42876-change-tracking you can create a short alias for it by sticking

    ref: origin/martin/f42876-change-tracking

into .git/CT, and from then on you can do git log CT or git rebase --onto CT or whatever?

Did you know that you can write topic@{yesterday} to mean “whatever commit topic was pointing to yesterday”?

Did you know that you can write ':/penguin system' to refer to the most recent commit whose commit message mentions the penguin system, and that 'HEAD:/penguin system' means the most recent such commit on the HEAD branch?

Did you know that there's a powerful sublanguage for ranges that you can give to git-log to specify all sorts of useful things about which commits you want to look at?

Once I got comfortable with Git I got in the habit of rereading the git-rev-parse manual every few months, because each time I would notice some new useful tool.

Check it out. It's an important next step.

[ Previous PSAs:

]

Read the whole story
kbrint
3 days ago
reply
git still rules.
Share this story
Delete

The Age of the Centaur is *Over* Skynet Goes Live

3 Shares

“Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm”

The game of chess is the most widely-studied domain in the history of artificial intelligence. The strongest programs are based on a combination of sophisticated search techniques, domain-specific adaptations, and handcrafted evaluation functions that have been refined by human experts over several decades. In contrast, the AlphaGo Zero program recently achieved superhuman performance in the game of Go, by tabula rasa reinforcement learning from games of self-play. In this paper, we generalise this approach into a single AlphaZero algorithm that can achieve, tabula rasa, superhuman performance in many challenging domains. Starting from random play, and given no domain knowledge except the game rules, AlphaZero achieved within 24 hours a superhuman level of play in the games of chess and shogi (Japanese chess) as well as Go, and convincingly defeated a world-champion program in each case.

In other words, the human now adds absolutely nothing to man-machine chess-playing teams.  That’s in addition to the surprising power of this approach in solving problems.

Here is the link, via Trey Kollmer, who writes “Stockfish Dethroned.”  Here is coverage from Wired.  Via Justin Barclay, here is commentary from the chess world, including some of the (very impressive) games.  And it seems to prefer 1.d4 and 1.c4, loves the Queen’s Gambit, rejected the French Defense, never liked the King’s Indian, grew disillusioned with the Ruy Lopez, and surprisingly never fell in love with the Sicilian Defense.  By the way the program reinvented most of chess opening theory by playing against itself for less than a day.  Having the white pieces matters more than we thought from previous computer vs. computer contests.  Here is the best chess commentary I have seen, excerpt:

If Karpov had been a chess engine, he might have been called AlphaZero. There is a relentless positional boa constrictor approach that is simply unheard of. Modern chess engines are focused on activity, and have special safeguards to avoid blocked positions as they have no understanding of them and often find themselves in a dead end before they realize it. AlphaZero has no such prejudices or issues, and seems to thrive on snuffing out the opponent’s play. It is singularly impressive, and what is astonishing is how it is able to also find tactics that the engines seem blind to.

Did you know that the older Stockfish program considered 900 times more positions, but the greater “thinking depth” of the new innovation was decisive nonetheless.  I will never forget how stunned I was to learn of this breakthrough.

Finally, I’ve long said that Google’s final fate will be to evolve into a hedge fund.

The post The Age of the Centaur is *Over* Skynet Goes Live appeared first on Marginal REVOLUTION.

Read the whole story
kbrint
6 days ago
reply
Share this story
Delete

The phonetic alphabet. Try spelling your name!

2 Shares


The phonetic alphabet. Try spelling your name!

Read the whole story
kbrint
7 days ago
reply
Share this story
Delete

One Year of Using Roccbox

1 Comment

The Pizza Bike: One Year of Using Roccbox

"We started using Roccbox in The Pizza Bike in August 2016 and 10 000 pizza later the ovens are working flawlessly without any problems. They do exactly what’s written on the box – heat up in 20-30 minutes, cook amazing pizzas in 90 seconds and are built to last for ages."

Read the whole story
kbrint
14 days ago
reply
Haven't used one, but it fits my desire for awesome pizza.
Share this story
Delete

The Jones Act and the Cost of Shipping Between U.S. Ports

1 Share

The Issue:

Efforts to help Puerto Rico recover from Hurricane Maria brought attention to the Jones Act, which prevents foreign-owned or operated vessels from shipping between ports in the United States, limiting competition in that type of transportation.

The Facts:

  • The Merchant Marine Act of 1920, often referred to as the Jones Act, requires shipping between U.S. ports to occur on ships that carry the U.S. flag, are built in the United States, and are owned by U.S. citizens. The act also requires crew on these ships to be comprised of at least 75 percent U.S. citizens or permanent residents.
  • The original rationale for this act was to support the American merchant marine fleet, an issue of concern after World War I. The Jones Act’s main purpose subsequently shifted towards supporting employment and work conditions for American shipbuilders and seamen.
  • The Jones Act raises the cost of transporting goods between American ports. For example, the cost of shipping crude oil from Texas to refineries in the East Coast is significantly more expensive per barrel than shipping crude to much more distant locations (see chart). In 2012, the Federal Reserve Bank of New York found that shipping cost for a twenty-foot container from the mainland United States to Puerto Rico was $3,063, but only $1,503 for the same container from the mainland United States to the neighboring Dominican Republic.
Read the whole story
kbrint
27 days ago
reply
Share this story
Delete

Fungus At The Wheel

jwz
1 Share
Today in Ophiocordyceps unilateralis news:

David Hughes wants to know exactly how this puppet master controls its puppets -- and his latest experiments suggest that it's even more ghoulish than it first appears. [...]

Hughes's team found that fungal cells infiltrate the ant's entire body, including its head, but they leave its brain untouched. [...] Hughes thinks the fungus might also exert more direct control over the ant's muscles, literally controlling them "as a puppeteer controls as a marionette doll." Once an infection is underway, he says, the neurons in the ant's body -- the ones that give its brain control over its muscles -- start to die. Hughes suspects that the fungus takes over.

It effectively cuts the ant's limbs off from its brain and inserts itself in place, releasing chemicals that force the muscles there to contract. If this is right, then the ant ends its life as a prisoner in its own body. Its brain is still in the driver's seat, but the fungus has the wheel.

Previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously, previously.

Read the whole story
kbrint
27 days ago
reply
Share this story
Delete
Next Page of Stories