For the next 5 weeks, I will be sleeping from 23:00-2:00 and 4:00-7:00, totaling in 6 hours of sleep per day. This is known as the segmented sleep schedule. If it goes well, I will likely continue with this schedule. For some of you 6 hours probably sounds like a lot, but I usually get 8 hours, so cutting out 2 is a significant improvement.
My motive behind doing this is that I was recently offered a research opportunity that I could not refuse (I will likely post about it later). To make time for it, I had to sacrifice something – my choice was sleep. About a year ago I was on a similar routine and it worked well, but I haven’t had the motivation to start doing it again until now.
So last night I went to a Haskell workshop.
One of the examples my professor gave was the factorial function:
factorial :: (Num a, Eq a) => a -> a
factorial 0 = 1
factorial n = n * factorial(n-1)
The first line is the function signature, the second line is the base case, and the third line is the recursive step of the function. One thing I really like about Haskell so far is how clean recursive functions are.
Today I started dabbling a bit more with Haskell and created a recursive function to calculate pi using the Gregory–Leibniz formula:
pie :: (Integral a, Fractional b) => a -> b
pie 0 = 0
pie n = sign * 4 / (2 * (fromIntegral n) - 1) + pie(n-1)
where sign = if even n then -1 else 1
I had to name it “pie” because “pi” was a reserved keyword. The “fromIntegral n” is there to allow an integer to be part of a fractional calculation. This is necessary because Haskell is über strict with types.
Here it is in action:
*Main> pie 1000
*Main> pie 10000
*Main> pie 100000
So I was digging through some of my old work while working on my résumé and ran into a research paper I wrote about BTRFS. Ever since writing this paper, BTRFS has a special place in my heart, so I wanted to share my research with the world :]
By now it is likely out of date, so posting it here should be fine.
BTRFS: Investigation of several aspects regarding fragmentation
A while ago I made a physics simulator for projectile motion which would gravitate towards the ground. I decided to build off this idea and make a free space gravity simulator!!!
To launch new planets, click and drag. When the planets collide, they will create a larger planet with a greater mass. The dynamics of this were done in a 3D perspective, so that is why planets grow very slowly in proportion to their mass build up (the mass is proportional to the cube root of the radius).
Check it out!
Conservation of momentum is followed, so launching a small planet with a high velocity at a large planet will produce a small velocity change due to the mass difference 🙂
So I am currently facilitating the hardware room at the UTM Hacks hackathon… Currently, everyone is settled down and hardware registration has been dead for a while, so I created a Chrome plugin!
The functionality is to play elevator music whenever you are on a login page. In my opinion, this is arguably one of the best plugins ever written 😉
Without further ado, here it is!