Linux Fork Bomb

Today, I learned a fun feature of shell called Linux Fork Bomb and this the piece of code I’m reading about:

:(){:|:&};:

Code Analysis

Let’s dive into this and have a little appreciation of the power of shell:

  • :() defines a function called :
  • :|: & runs function : , sends output to : and run in background
  • {...} indicates whatever inside is the content of the function :
  • : calls function for the very first time

Essentially you are creating a function that calls itself twice every call and doesn’t have any way to terminate itself. It will keep doubling up until you run out of system resources.

Some fun observation

: used as a placeholder in shell. For instance, while trueis same as while :. However, this may only work for bash because : is a built-in command for some shell and the buil-in command : has precedence over the function :. So, when we actually execute our bomb, built-in : will get executed instead of our function. So, bomb has been defused.

Here also offers  some insights on how to prevent fork bomb like this. It involves RLIMIT_NPROCIt is definitely worth to dig further.

You can watch a live demo and see how powerful the linux fork bomb can be.

Advertisements

A recap on EPH program

This week (05/16 – 05/20), I attended 2016 GCG Early Professional Hire (EPH) Program offered by the company. The following is the recap of the whole program with some of my thoughts.

Pre-show

GCG Early Professional Hire (EPH) program run by IBM is a 2-year program that targets specifically at the new employees with working experience less than two years. It aims to develop core and valuable skills for the new IBMers. When I first receive the advertisement email, my incentive tells me not to attend even though it is required for new hires (you can reject by obtaining approve from your manager). However, I figure it is a good chance to take a break from the work and have a chance to meet some people (some beauties if I’m lucky and in fact, there are some), so I withdraw my request to not attend.

Kick-off Event (05/16 – 05/19)

Day 1

Morning

The kick-off Event is hold at Marco Polo Parkside Hotel in Beijing. It is really a fancy hotel and I’m really surprised that my company could spend so much money hosting an event in a hotel like this, especially it has been rough years for GCG.  The agenda for the first day consists of bunch of speeches, BU introductions, and a welcome dinner.  Sign in starts at 9 is quite tough for me as the distance between hotel and my apartment is 11.5 miles! However, “Watson Coffee” (some fruit and yogurt) helps me to go through this tough time to wait for event start at 10.

Morning speech is not quite impressive. The first speech is delivered by Shally Wang, GM of GCG. She talked about something that I could hardly recall but her opening talks about moving start time earlier to compensate the people get there early is quite thoughtful at some level.

The next speech is delivered by Anita Sabatino, a senior leader at IBM. I have to say her speech is the only shinning point on Day 1. She recaps her career at IBM:

She starts as a software engineer at IBM and becomes a sale once she is a advisory software engineer. She then changes the role to sales and work for JP Morgan for a couple of years before rejoining IBM. She then moves to China with her daughter who is adopted from China and works with Bank of China. She gives examples on how to build trust with clients. For instance, meets with leader from BOC weekly and always be on time; Build personal relationship to a reasonable amount that facilitates the collaboration. Also she shares some stories about her daughter.

This is a quite good speech because it has really substance. It is not hollow words without any meaning. It feels like a friend talks about career directly to you. Plus, I’m always interested in people sharing their career story and how they make decisions.

The last part of the morning consists of people from GCG share their story to new hires. They are not as senior as previous speakers but they are experienced. I didn’t quite listen to their talk shows because it’s already 12:30pm when they start their sharing and I’m quite starving. All in all, it’s just some show value stuff so that they can brag to their boss. Nothing new.

Afternoon & Evening

The lunch is buffet and I heard it costs around 200 RMB per person. It is quite good and I had a tons of steak and ice cream. The key word for the afternoon is “BORING”. It consists of speeches from different BU leaders (GTS, CAMSS, GBS, Technology Partnership), which essentially wants you to have a big picture about their BU and appreciate their business value. The rest of the day is a nice welcome dinner and some shows from fellow IBMers. The shows are quite nice but unfortunately I cannot sit till the last minute because it still went on at 8:30pm and I’m afraid of missing the last subway back home.

Day 2 – 4

These three days consist of four main parts:  building your professional reputation@IBM, workplace etiquette, delivering quality work with agility, business writing. The overall is quite boring but there are indeed some shinning points that are worth to mention:

mmexport1463657100629

BU Session (05/20)

There are two great speeches delivered today. One delivered by Ge Song, CDL cloud leader and the other one delivered by Zhong Tian, the only Distinguished Engineer (DE) at CDL.

Ge Song’s Speech

Ge Song’s speech mainly focuses on some takeaway she gets from Things I Wish I Knew Before Working in Industry (this source based upon her reference during the speech but could be wrong as she didn’t explicitly cite the source). The following are the key points she mentioned (I write them down based upon my audio record):

  1. Attitude makes everything; be willing to do more. She draws on her own experience and offers an example: When she started her career at IBM, her manager sometimes got challenge tasks and asked if anyone is willing to take it. The most courage sentence she could ever say at that time was “I can try it!” even she knew she was totally capable of doing it. So, she suggests that if you are pretty sure you can handle the task, then always say “I can do it!” This is because it is the manager’s responsibility to help you to succeed at your task. They will do whatever they can to help you (frequently review …) and to control the risk. They will not blame you for the failure because it is their failure if you fail. Also, be willing to take more tasks whenever possible and necessary. Don’t be the kind of person that cannot hang around any longer after 5pm and can’t wait to catch the first shuttle to get back home. So, always remember “No pain no gain”!
  2. Be visible (show value). The example she gives here is the global conference call scenario. Usually, for Chinese, people barely talk anything during the call except “Hi! I’m Mark.”, “Bye Bye!”. That doesn’t work in the sense that you don’t show your value. Here is a tips. If you know the conference call will discuss some difficult problem beforehand, you can prepare for that. When global team leader asks for any input, you should speak up (because you’re already prepared).
  3. Find your mentor. Everybody knows what mentor means for a person’s career. Here, she emphasizes that you should build a solid skill (foundation) before you ask for changing mentor.
  4. Be yourself and build your identity (Build your personal branding). You need to strive for excellence for the area you are working on (become a goto person). However, you don’t have to care how people treat you. Build your expertise and keep learning! “忠实于对技术的感情!”
  5. Think big and act from small (志存高远,从小事做起). 不要好高骛远!不要老觉得某个leader很强而忘记他在技术领域的耕耘。Again, she offers a tips regarding conference call. You need to focus two points during the call. 1. Why she asks this kind of technical question? 2. Develop your English speaking skill.
  6. Managing your time. You will become the person that you spend the most time on.
  7. Priority. briefly mentioned.
  8. Managing the risk. briefly mentioned.
  9. With courage to say “No”! briefly mentioned.
  10. Not only plan your career, also your life. briefly mentioned.

Zhong Tian’s Speech

Zhong Tian’s speech focuses on the share of a technical career. I listed some of the inspirational sentences he mentioned:

  • Keeps learning!
  • Excel what you do, the world is yours!
  • 不要觉得你是band6就应该做band6的活,如果你是band6已经在做band7的活的话,你离promote已经不远了!

Source code security

Well, this is a post that I started on 2016-04-15 and I finally finish today…

Yesterday morning (04/15/16), when I came to the office, I got a bad news from my manager: he was informed by security that I had an abnormal checkout of code on Monday, 04/11/16. The way how things work regarding source code security in our lab and probably in IBM other labs is that security will track each developer the frequency and quanity of checkout each day. They collect some statistics and alert the first-line manager when something potentially terrible happened. For instance, if I usually checkout code twice per day and each time around 20 source files, but on 04/15/16, I checkout 3456 files in day will certainly set off the alarm. Believe me, this number is exactly the number I was informed from my manager. What did I do on that day? It turns out that I need to make a special build on top of a GA build for a client and I need include all the code change specifically for this client in the past plus my code this time. The way to make a special build is that we use some scripts to check out the source files that are needed to be changed and merge the code, and run test buckets on them. Those will involve tons of checkout & checkin. After all, I successfully explain this to my manager and everything works out at last.

What interests to me for this incident is that this is the first time I realize the power of Clearcase. I have never heard of ClearCase until I join IBM. Back to the college, I solely work with Git and I feel extremely uncomfortable when I firstly work with ClearCase. However, from this incident, I personally start to feel like ClearCase is probably more powerful than Git on security level. Basically, in Git world, I need to fork or clone the repository so that I can have a local copy of ALL the source code and to start work on my branch. There has some problem in terms of security because I literally need to have all the code locally before I can work on my stuff. Make branch on the remote repository also has this issue. However, in ClearCase, I only need to first make a dynamic view and only check out the files I need to modify. If I check out too many files that will raise warning like this time. This security checking mechanism works great with ClearCase because:

  • There is a central server to hold all the source code. A Corporation can simply monitor the checkout behavior of this central code repository.
  • the quantity of checkout is different from person to person. In Git, it feels like a standard way for everyone to checkout all source files even you only need to modify one. However, with ClearCase, that can be different from person to person. This will the statistics monitoring checkout becomes meaningful.

I’m not saying Git is bad. In fact, in IBM, we are starting to have GitHub Enterprise that hosts on SoftLayer behind IBM firewall. That is really a great news for me because I can finally have “social coding” experience that I have been enjoying so far outside of the work. It will make some work I have done tailored specifically to fellow IBMers more organized and easy to get. I don’t need to attach the code inside emails sent to each member of the team that we collaborat with one by one. I can simply send the git repo to their team lead and each member of their team can access simultaneously. Plus, having Github inside IBM also helps me to track issue with the code I own and again, saves ton of communication cost for me.

一些养猫的新手入门经验

今天带我们家小虎去做了一次健康体检,检查的主要是小虎身上有没有一些传染人类的疾病以及小虎本身是否携带一些猫的疾病。今天我得到的是小虎本身是没有携带一些传染人类的疾病的,但是小虎本身的检查报告还得等待2,3天。希望一切顺利!

IMG_20160502_115306.jpg

上面是给小虎看病的诊所(好遗憾没能拍下小虎的照片)

通过这次检查,我也学到了一些关于养小猫的入门指南 (特别针对1个多月的小猫),特地记录如下:

  1. 每个季度需要驱虫(用特殊的驱虫剂在小猫脖子抹一下)
  2. 未做免疫之前禁止洗澡,禁止外遛,禁止与其他犬猫接触
  3. 一般在做免疫之前10到15天需要做身体检查,然后需要观察排便,排尿情况。如果在10到15天内一切正常的话才可以去做免疫
  4. 1个多月的小猫只能吃幼猫猫粮(推荐伟嘉),喝清水(不能是牛奶),禁止吃人吃的食物,如果猫粮不爱吃可以增加猫妙鲜包、罐头等食物
  5. 准备好猫用的物品:猫砂,猫砂盆,饭盆,水盆,猫笼 (猫垫可能不需要,因为小猫很难像小狗一样去固定地方睡觉)
  6. 对于刚拿到新环境的小猫,尽量保持安静让小猫适应家中环境
  7. 可以与猫多接触按摩猫增加感情
  8. 眼睛每天清理2次,早晚各一次,清理完上药一次,一次一滴
  9. 营养膏:一天3次,一次1-2厘米 (避免小猫因为不吃东西导致营养不良)

IMG_20160502_135432.jpg

 

A Cat

Today, I finally got a cat. It has been really long time since I owned a pet (last one is a duck, which I got when I was in 5th grade). I got really excited and nervous, and I plan to take her/him to pet hospital to see if everything is OK with it. Afterwards, I can finally devote myself to something that is not electronic.

 

microMsg.1462104997597