Python RGB Convertor

A handy python script I made to convert 8-bit colour codes to openGL/Renderman style RGB. Someone else might find use for it, designed to run from terminal. I have the following alias in my bashrc:

alias rgbConv='~/./'

This then lets me run it from terminal easily. You just need to put it in your home directory and change the name if necessary.

Feel free to copy it from below

#Using code from
#to handle the clipboard
import pygtk
import gtk
import sys
print "RGB Converted!"
r = float(sys.argv[1])
g = float(sys.argv[2])
b = float(sys.argv[3])
    r = 255
    g = 255
    b = 255
rgb = str('%.2f' % (r/255) +'f'+ ','
        + '%.2f' % (g/255) +'f'+ ','
        + '%.2f' % (b/255) +'f')
clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()

China Part 2

I spent the bulk of my trip at a summer school in SIAS International University in Henan province. Henan is the most ancient part of China, the oldest examples of Chinese characters were found there, but unfortunately the provincial museum was closed for refurbishment so I couldn’t see any of these “Oracle Bones” in the flesh.

Over the course of the camp I learned some basic “survival Chinese” which proved somewhat handy, especially the numbers. In China they have a system to count from 1-10 on their hands, meaning that you can do 1-99 on two hands which is really cool!

We also learned some contemporary Chinese law and History, it was really interesting to learn about these things without a western bias, for example how Mao is still seen as a hero here by the majority of people. According to our lecture he was 70% good and 30% bad, but I think the split is up for debate.

We were lucky enough to have Chinese ‘pals’ that helped us to translate when we went off campus, they were all incredibly hospitable and couldn’t be happier to help. We had great fun at places outside the uni, like a local bar that brewed its own ale and at the KTV!

The campus itself is unbelievable, it was like if Vegas did education! There was a mini Florencian square, Red Square, Spanish Square and they are working on expanding, starting with a Palace of Westminster. They also had a basketball court that we were lucky enough to play a game on, in front of 300 people, after a large dinner… But we did end up winning, after a little help from our Chinese counterparts!


We were lucky enough to visit Foxconn in ZhengZhou (jungjo) at a site where they employ over 250,000 staff. It was strange to visit a place where I have never been but the laptop I am writing this on was assembled. The company is taking may steps to improve its working conditions and I wish them all the best with achieving that goal!

The global festival of learning (the main reason we were there in the first place!) took place on our last 2 days at SIAS and it was interesting to see how the Chinese students learned in lectures. Lots of notes and no questions. A professor from America that we had, talked about this and how since Chinese children have to learn thousands of characters from a young age, to be able to read they learn to be amazing memorisers. Then later in there school career comes the dreaded GaoKao that really puts those skills to the test.

We finished our trip with 48 hours in Shanghai, where I am writing this post. Shanghai is probably the most mad but coolest place I have ever been, you can buy deep fried scorpions, turn left and four meters ahead is an M&S. I’m sitting in the hotel bar listening to a conversation in Russian, across from some Americans while a local guy enjoys a cigarette indoors; all while enjoying a European beer and watching EURO 2016 highlights.

We did all the touristy things i.e. Pearl Tower and tea shops but we also got to walk around and take in the organised madness that is the city. Lots of the buildings look like those that you would find in London around “The Bund”, they look Chinese in some corners but mainly like a huge modern metropolis everywhere else, with huge amounts of sky scrapers.


I have written a small list of tips for those looking to travel to China:

  1. Bring Toilet paper in your pocket, it is not always provided.
  2. If you are planning on learning some of the language, learn pīnyīn and speech only don’t worry about characters
  3. If you want good internet buy a Chinese SIM with preloaded data, as the WiFi is slow or few and far between
  4. Roads are crazy, horn means “I’m not stopping” and red lights do not seem to apply to taxis and bikes
  5. Bring hand sanitiser as toilets may not have soap
  6. Make the most of it, there is so much to do here in two weeks I only scratched the surface.

My closing thoughts on China are as follows; China has so much that is impressive, but the most impressive thing for me is the peoples ability to change. I am staying in a hotel with people that may have been alive in the cultural revolution that then use their smartphone to pay for bowling. As China continues to grow the population facing many challenges but I would say that after spending two weeks here if anyone can handle the future it is the Chinese!

So if you ever get the chance I can’t recommend a visit to China more!

China Part 1

First of a couple posts about my BU Destination China Trip:

Days 1, 2 and 3 were spent in Beijing mainly doing tourist type visits and getting a feel for the Chinese culture.

Due to flight delays we had no time to check into a hotel so we got on the bus from the airport to a restaurant for lunch, first time with Chinese food and because I had not eaten for a while it was easy to learn how to use chopsticks quickly!

After this it was straight to Tiananmen Square, this is a great way to be introduced to the city, it serves as a reminder of China’s modern history as well as showing the vast numbers of people that live in Beijing. The square is adjacent to the Forbidden City, it had been a lifelong dream to visit and it does not disappoint, it is a fantastic testament to the Chinese ability to build some of history’s most beautiful buildings. Not only this but the juxtaposition of the square and the city is really striking.

After a small amount of sleep we were up early to visit the Badaling section of the Great Wall, it well was sacrificing sleep. The wall is something that is difficult to comprehend even after visiting. Until you visit you really don’t realise how you ‘climb’ the Great Wall rather than walk, some steps were a foot and a half tall, and the slopes felt like they were 45 degrees at times. Perhaps why at the summit of the section there were many people selling medals and licenses but the shop selling cold water and ice cream when we climbed back down proved much more useful!


Then we visited the summer palace, which is much more reminiscent of an English stately home, a beautiful lake, temple and garden it really was a tremendous sight. The aptly named long corridor  served as a beautiful promenade to stroll down and take in the atmosphere. Here it was most evident of the Chinese culture of happiness and peace. As we strolled we saw people sleeping under trees, families enjoying a picnic and we were greeted by a guard as he walked down asking people to take their feet off the side.

In the evening we visited Wangfujing Street something like Oford street only much much larger. We shopped around a bit, but the brands are mostly the same designers we have in the UK. After this we spent a couple of hours in a German themed pop up bar and met some of the interesting characters that were also visiting Beijing from abroad.

Day three was a great chance to visit Xiaomi a smartphone company, as a field I would love to work in in the future. What was so great about Xiaomi was their commitment to making life better and more affordable for its customers. Bit smartphones is really the tip of the iceberg for the company, they had a whole range of products from a rice cooker to high end TVs. We met with an executive in a casual shorts and t-shirt who told us that the best way to experience the culture of Xiaomi is to go to the shop and try the products. And it was hard to disagree, the phones (from what i could tell from the Chinese spec sheet!) were comparable to iPhones and similar products yet they were available for 800RMB (Approx £80) and up.

What was so impressive was the innovative and broad spectrum of products available as many people are now saying such as in this article, apple has not really made a new innovation in a long time. In contrast Xiaomi has a wide range of home appliances, portable speakers, a Segway like device and health products such as a blood pressure monitor (or a sphygmomanometer for those that like long words!). This was just further showing their commitment to real innovation, and of course all of it was affordable for the Chinese market.

The afternoon was a trip to a very old Chinese market (reminiscent of Camden) this is a great way to finish our stay in Beijing the contrast between old and new is striking here, and makes the industrious nature of the Chinese people much more impressive to know that it has been consistent throughout its thousands of years of history.

I recommend looking up pictures of all the places I mentioned if you are not familiar but if you ever have the opportunity to see them first hand I couldn’t recommend it more.

Global Game Jam 2016

I recently took part in the Global Game Jam 2016, the following post is about my experience with it (all good things!). If you are unfamiliar with the concept of the jam more can be found here!

At 5pm we were given the theme “Ritual”, many ideas came out but eventually we settled on the basic idea of a top down shooter. The levels would be on the sides of a cube and it would rotate around as the screenshot below shows.

Cube Cleanser

It was fairly ambitious for a first game jam project but we were up to the challenge. The next 48 hours consisted of very little sleep, lots of caffeine and some game creation also, after all it seemed appropriate to at least make most of a game.

I learned a lot from it, not only about the effects of sleep depravation on code, but also valuable lessons about why it is good to make your code maintainable. For instance if you need to change it after being awake for 30 hours straight it is helpful if you don’t have to re-remember how it all works!

Although we didn’t get the game to a polished state I’m pleased with the completeness of it, although the game is not actually winnable. The game as it was submitted can be found at the link below, it should run on Mac and Windows but send a message if you cant get it to run. Would love to hear what you think about it!

I’d like to thank the team (Tom, Ivan and Alberto) for making the weekend great fun as well as of course the organisers of the jam and the Unity engine for making a robust engine that made the game much easier to program than it would have been without it!