Friday, August 23, 2013

Personal Music Library

Since my music library and knowledge kindda sucks, I've decided to give some of the classics a try at the rate of one new song everyday. Feel free to post suggestions in comments.

23/07/2013
Pull Me Under - Dream Theater (cover) - http://www.youtube.com/watch?v=6h2h4zIhwuM

24/07/2013
Soothsayer - Buckethead - http://www.youtube.com/watch?v=fWgOC4xCVPI

Wednesday, August 7, 2013

A 10,000 line OS!!

Hey peepulz!

I recently came across a 10,000 line OS, written for educational purposes. It's called xv6, and it's pretty basic - just a shell with very limited ability to create files, but it's a fully self-contained OS that boots on it's own. It's used by MIT folks (and many other universities) for their advanced Operating Systems course (6.828, video lectures here).

It also comes with a free textbook that details its internals. You need to have qemu installed for running xv6 in a VM.

Get source code here:
git clone git://pdos.csail.mit.edu/xv6/xv6.git 
Instructions on booting
http://zoo.cs.yale.edu/classes/cs422/2013/lec/l2-hw
Manual:
http://pdos.csail.mit.edu/6.828/2012/xv6/book-rev7.pdf
More info:
http://pdos.csail.mit.edu/6.828/2012/xv6.html

Thursday, March 7, 2013

50 Things [Reblogged]

Reblogged - is that a term? Anyhoo, came across a lovely blog post and thought I'd share it with you guys (also serves as a personal reference in this age of broken links, you wouldn't believe the amount of browser tabs and bookmarks I've lost track of).

Original source - http://mitadmissions.org/blogs/entry/50_things


Dear Class of 2010,
This will be my last entry written specifically for you; beginning with the launch of our new site in early September, I'll begin focusing on the future class of 2011. I hope that you guys won't be strangers; stay in touch either in person (come visit us!) or online (please drop by the blogs from time to time and say hi).
As you begin your college experience, and I prepare for my 10-year college reunion, I thought I'd leave you with the things that, in retrospect, I think are important as you navigate the next four years. I hope that some of them are helpful.
Here goes...



  1. Your friends will change a lot over the next four years. Let them.
  2. Call someone you love back home a few times a week, even if just for a few minutes.
  3. In college more than ever before, songs will attach themselves to memories. Every month or two, make a mix cd, mp3 folder, whatever - just make sure you keep copies of these songs. Ten years out, they'll be as effective as a journal in taking you back to your favorite moments.
  4. Take naps in the middle of the afternoon with reckless abandon.
  5. Adjust your schedule around when you are most productive and creative. If you're nocturnal and do your best work late at night, embrace that. It may be the only time in your life when you can.
  6. If you write your best papers the night before they are due, don't let people tell you that you "should be more organized" or that you "should plan better." Different things work for different people. Personally, I worked best under pressure - so I always procrastinated... and always kicked ass (which annoyed my friends to no end). ;-) Use the freedom that comes with not having grades first semester to experiment and see what works best for you.
  7. At least a few times in your college career, do something fun and irresponsible when you should be studying. The night before my freshman year psych final, my roommate somehow scored front row seats to the Indigo Girls at a venue 2 hours away. I didn't do so well on the final, but I haven't thought about psych since 1993. I've thought about the experience of going to that show (with the guy who is now my son's godfather) at least once a month ever since.
  8. Become friends with your favorite professors. Recognize that they can learn from you too - in fact, that's part of the reason they chose to be professors.
  9. Carve out an hour every single day to be alone. (Sleeping doesn't count.)
  10. Go on dates. Don't feel like every date has to turn into a relationship.
  11. Don't date someone your roommate has been in a relationship with.
  12. When your friends' parents visit, include them. You'll get free food, etc., and you'll help them to feel like they're cool, hangin' with the hip college kids.
  13. In the first month of college, send a hand-written letter to someone who made college possible for you and describe your adventures thus far. It will mean a lot to him/her now, and it will mean a lot to you in ten years when he/she shows it to you.
  14. Embrace the differences between you and your classmates. Always be asking yourself, "what can I learn from this person?" More of your education will come from this than from any classroom.
  15. All-nighters are entirely overrated.
  16. For those of you who have come to college in a long-distance relationship with someone from high school: despite what many will tell you, it can work. The key is to not let your relationship interfere with your college experience. If you don't want to date anyone else, that's totally fine! What's not fine, however, is missing out on a lot of defining experiences because you're on the phone with your boyfriend/girlfriend for three hours every day.
  17. Working things out between friends is best done in person, not over email. (IM does not count as "in person.") Often someone's facial expressions will tell you more than his/her words.
  18. Take risks.
  19. Don't be afraid of (or excited by) the co-ed bathrooms. The thrill is over in about 2 seconds.
  20. Wednesday is the middle of the week; therefore on wednesday night the week is more than half over. You should celebrate accordingly. (It makes thursday and friday a lot more fun.)
  21. Welcome failure into your lives. It's how we grow. What matters is not that you failed, but that you recovered.
  22. Take some classes that have nothing to do with your major(s), purely for the fun of it.
  23. It's important to think about the future, but it's more important to be present in the now. You won't get the most out of college if you think of it as a stepping stone.
  24. When you're living on a college campus with 400 things going on every second of every day, watching TV is pretty much a waste of your time and a waste of your parents' money. If you're going to watch, watch with friends so at least you can call it a "valuable social experience."
  25. Don't be afraid to fall in love. When it happens, don't take it for granted. Celebrate it, but don't let it define your college experience.
  26. Much of the time you once had for pleasure reading is going to disappear. Keep a list of the books you would have read had you had the time, so that you can start reading them when you graduate.
  27. Things that seem like the end of the world really do become funny with a little time and distance. Knowing this, forget the embarassment and skip to the good part.
  28. Every once in awhile, there will come an especially powerful moment when you can actually feel that an experience has changed who you are. Embrace these, even if they are painful.
  29. No matter what your political or religious beliefs, be open-minded. You're going to be challenged over the next four years in ways you can't imagine, across all fronts. You can't learn if you're closed off.
  30. If you need to get a job, find something that you actually enjoy. Just because it's work doesn't mean it has to suck.
  31. Don't always lead. It's good to follow sometimes.
  32. Take a lot of pictures. One of my major regrets in life is that I didn't take more pictures in college. My excuse was the cost of film and processing. Digital cameras are cheap and you have plenty of hard drive space, so you have no excuse.
  33. Your health and safety are more important than anything.
  34. Ask for help. Often.
  35. Half of you will be in the bottom half of your class at any given moment. Way more than half of you will be in the bottom half of your class at some point in the next four years. Get used to it.
  36. In ten years very few of you will look as good as you do right now, so secretly revel in how hot you are before it's too late.
  37. In the long run, where you go to college doesn't matter as much as what you do with the opportunities you're given there. The MIT name on your resume won't mean much if that's the only thing on your resume. As a student here, you will have access to a variety of unique opportunities that no one else will ever have - don't waste them.
  38. On the flip side, don't try to do everything. Balance = well-being.
  39. Make perspective a priority. If you're too close to something to have good perspective, rely on your friends to help you.
  40. Eat badly sometimes. It's the last time in your life when you can do this without feeling guilty about it.
  41. Make a complete ass of yourself at least once, preferably more. It builds character.
  42. Wash your sheets more than once a year. Trust me on this one.
  43. If you are in a relationship and none of your friends want to hang out with you and your significant other, pay attention. They usually know better than you do.
  44. Don't be afraid of the weird pizza topping combinations that your new friend from across the country loves. Some of the truly awful ones actually taste pretty good. Expand your horizons.
  45. Explore the campus thoroughly. Don't get caught.
  46. Life is too short to stick with a course of study that you're no longer excited about. Switch, even if it complicates things.
  47. Tattoos are permanent. Be very certain.
  48. Don't make fun of prefrosh. That was you like 2 hours ago.
  49. Enjoy every second of the next four years. It is impossible to describe how quickly they pass.
  50. This is the only time in your lives when your only real responsibility is to learn. Try to remember how lucky you are every day.

Be yourself. Create. Inspire, and be inspired. Grow. Laugh. Learn. Love.
Welcome to some of the best years of your lives.
-B

Sunday, December 16, 2012

Reference for some nifty Linux tricks

CLI is fun, but the commands can be a bit of a pain to remember. Here's some stuff I'm writing for my own reference, but it might be useful to you too.

1. Create a disk image

dd if=/dev/sda of=<fileName>

Web references also specify block size etc, but I didn't need them, apparently.

2. Mount that disk image

mount -o loop,offset=$START*512 -t [auto|FSType] /path/to/image /mount/point

loop - used to mount files as block devices or something

$START - the start value of that partition in fdisk -l or fdisk /path/to/image

3. Turn screen off (as in power save mode)

xset dpms force off
xset dpms force off; xscreensaver-command --lock #[Locks screen also] 
 
 
4. Find the process using a file

fuser /dev/sda3
fuser /path/to/file

 
5. Spindown your HDD (eject from nautilus doesn't work)

Obtain the sdX->sgY mapping
sg_map

sdparm -C stop /dev/sgY

6. Install Ubuntu on newer UEFI systems along with Windows 8.

Ok, so Wubi won't work on the newer UEFI-enabled systems. So don't even bother. Either use Ubuntu as a Virtual Machine (tsk tsk...) or follow this guide.

http://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-windows-8-64-bit-system-uefi-supported

Thursday, November 8, 2012

Operating Systems!


This post is intended to serve as an archive for various interesting links/references/sources I come across while doing OS assignments or other stuff. I hope you find these as useful as I do. Most of these were (shamelessly?) copied from the first page of Google search results (as someone said, the best place to hide a dead body is the second page of Google search results).

http://stackoverflow.com/questions/1401359/understanding-linux-proc-id-maps

http://tcpdumper.blogspot.in/2009/05/minor-fault-vs-major-fault.html (Good for VM basics)

http://igor.chudov.com/tmp/LinuxVM/html/understand/node35.html (Good link for page faults, but there seems to be lots of documentation on other aspects as well)

http://condor.depaul.edu/slytinen/373f12/l1.html (Nice notes, I guess)

Note to self: awk '{ print $1 }' - double quotes won't work, printf won't work, add awk to to-learn list.

11/11/12

Just came to know about a tool/lab assignment called Buffer Bomb. It's based on buffer overflow attacks, and apparently, is a standard assignment/activity at many universities. Kind of puts into perspective the number of things IIIT's Operating Systems course is missing.

Useful resources:

https://docs.google.com/viewer?a=v&q=cache:M6bI62pfENkJ:condor.depaul.edu/glancast/373class/docs/lab3.pdf+&hl=en&gl=in&pid=bl&srcid=ADGEESiOjL7s9ZC3Wx_-6ndlBiWvXB9QqWkHMP9qE27Xjirgnl48tHErHkqoX2apzmCejB32039mvDQAZ_T8o26PSVxh8SHe7_VMRHFy8i_3Q4QWazGafmLK9Iw3CT6kO6fiM5Grupj5&sig=AHIEtbQV86i2aX_1ZbcQ68rngusq_kF2TA

http://www.ricera10.com/wordpress/?p=2516

http://conniefan.com/tutorials-labs-from-computer-systems.html

http://www.cs.rochester.edu/u/scott/252/assignments/A3.shtml

 ------------------------------------------------------------------------------------------------------------------------


Monday, June 4, 2012

Tackling Ubuntu installs for dv6 users - part 1

In the last 6 months, I've seen a lot of people buying HP dv6 laptops. HP has had a bad reputation with laptop buyers with all the heating problems and other issues, but it seems to have hit the bulls eye with the newer dv6s. Newer models arrive frequently, and are quite a bit of improvement over the older ones. The dv6 6012tx, for example, made a major leap in sound quality, and I would rate its sound almost as good as the XPS's famed JBL speakers (yep, it's that good). With all the hardware improvements, care packs (extended warranty packs) that cost half as much as Dell's, and a much sleeker profile, the dv6 has emerged as a solid alternative to the XPS.

(PS: I can't vouch for HP's warranty quality, but I know for a fact that Dell's is downright awesome. They are more than happy to change parts, whatever the reason for failure be. However, seeing that I spilled lassi on my lappy's keyboard, causing 4-5 keys to stop functioning, a review on HP's after-sales service will be up shortly). The only thing that disappoints me in the newer dv6 7000 series is the switch from AMD Radeon 6770M in the i7 model to nvidia 630M. Granted, nvidia's switchable graphics implementation (called Optimus) is much better than AMD's. Getting AMD cards to switch smoothly can be a pain in Linux, which is what this post is all about. But the 6770M is a solid mid-end graphics card, ranking 82nd on notebookcheck's mobile graphics rank lists, whereas the 630M is decidedly mainstream at a rank of around 112.

Anyway, if you are a new dv6 user who plans to install Ubuntu, you'll have a fair share of problems, more than XPS users anyway.

First, you'll have to deal with HP's ABSOLUTELY HORRIBLY HORRENDOUSLY (DIE, YOU PARTITION SCHEME DESIGNING BITCH AT HP!!!) CRAPPY partitioning scheme. HP saves the average noob the trouble of evaluating a different OS, because he won't be able to make an informed choice on how to re-partition his system. Here's HP's partitioning scheme found on all dv6s. It consists of four primary partitions (which is the maximum number of primary partitions allowed on a hard drive).

1. (<100 MB) Bootloader partition - This one contains files required by Windows at the time of boot.
2. Windows partition - it contains the Windows install and most of the empty hard disk space.
3. (~14GB) Windows recovery partition - it contains files needed to restore Windows to a factory state in case you've screwed up with your current install. It can also be used to create recovery DVDs (only one set of such DVDs can be made).
4. HP_TOOLS (<100MB) - This partition is required if you need to upgrade the BIOS. If you download and run the BIOS setup from HP website, it places new files in this partition, and these files are detected by the OS on restart.

If you want to install another OS, you need to get rid of one of these partitions, since there is a limit of four primary partitions per hard drive.

In my opinion, the HP_TOOLS is the most expendable since it's easy to restore it in case a newer version of the BIOS with some major feature is released. First, make sure you've installed the latest BIOS available on the website, and then you can remove this drive. Some people prefer to create recovery DVDs and then remove the recovery partition, but I don't trust optical disks. IMO, they're too fragile and prone to environmental factors. Plus, the convenience of having a recovery partition on the hard disk in unmatched. Although, you can not combine the 100MB you gained by removing HP_TOOLS with the space recovered by shrinking the Windows partition. Which means that that 100 MB as good as gone, small price to pay for the freedom to install any OS.

Anyway, you can then shrink the Windows partition by some suitable amount - I prefer about 40GB for Ubuntu. I also suggest that you mount /home and / on separate logical partitions. It comes in handy when you're testing multiple distros. After that, it's quite easy - installing Linux is a breeze once you figure out the partitioning scheme, even if tweaking it to get all hardware working is not.

That's it for this post. In the next post, I'll outline how to switch off that darned discrete GPU by installing the fglrx driver.

Sunday, May 13, 2012

youtube-dl - a CLI script for downloading streaming videos

Yes, I've been lazy and negligent about updating this blog, but then, that's the story of personal blogs worldwide.

Anyway, this one's gonna be short and quick. I just found out a Python-based script youtube-dl to download youtube (and other supported) videos via command line.

You can get it here:

http://rg3.github.com/youtube-dl/

The syntax is pretty simple, once you have added executable permissions to the script (requires Python 2.5 or newer):

./youtube-dl <Web URL here>

Or you can check your official repositories for a package called 'youtube-dl'.

There're a plenty of tools/addons/websites available online, and most of my batchmates have their own versions of youtube downloaders to their credit, so why this post?

1. Apparently, with browser/OS/whatever updates, the older method of copying the streamed video from the file descriptors (/proc/*/fd/*) doesn't work.

2. This thing does not use the 'saving streamed content' concept. It *somehow* obtains a download link by itself. And it's written purely in Python. Understanding how it works could help you in clearing a lot of concepts. (Fair warning though: it's a 4500 line code, and most of the modules used are unheard of, to me. This one's not for the weak at heart.)

3. If you just wanted a method to get it done, and are least interested about the inner workings of such utilities, I'm sorry - you're looking at the wrong blog.