The Malbolge program in the show is almost the real thing. It is the same program given in the Wikipedia article on Malbolge except for three or four altered characters about 30 characters missing from the end. The program in the Wikipedia article just displays "Hello World!".
The firm hiring Holmes is called Casterly Rock. This is also the name of the homeseat of the Lannisters in Game of Thrones (2011). The Lannisters are known for their wealth.
In the opening scene, Gwen is wearing the very same t-shirt Sherlock donned in front of Joan in the pilot episode that says "I'm not lucky, I'm good".
During the lunch scene, Watson's mother mentions that she heard from Watson's brother, Oren. O-Ren Ishii is the name of Lucy Lui's character in Kill Bill, Vol 1 (2003).
Holmes talks about the Malbolge programming language being named after the 8th circle of Hell.
The 8th circle is for fraudsters, particularly soothsayers and fortune-tellers. As the inmates pretended to see what was to come, they are doomed to spend eternity walking endlessly with their heads turned backwards so that they can only see what is behind.