Thursday, August 11, 2011

Hardly working hard

I am lazy. I don’t remember when it began, but to the great frustration of my mother, it has yet to end. Luckily though, there are many tools available for the lazy software engineer, some of which I’d like to share today in this post.

Too lazy to type?

I like saving key strokes. Why type when you can...not type? There are a couple of bash tricks I learned from Carlos and Jesse that I really like:

  1. cd - cd to last visited directory. Everybody knows about cd ~, but this is at least as useful. Instead of taking you home, cd - takes you to the last directory you visited.

Example use case:

cd /path/to/logs

tail log1 | cut -f 3 | sort

tail log2 | cut -f 5 | sort

cd -

vim

2. ctrl + r: Reverse search bash history. Here at Adku, we run A LOT of map reduces. Most of the time, we’re calling the same few commands. ctrl + r lets us run, forget, and then run again later.

Example use case:

fab some_map_reduce_job:arg1=’ahhhh’,arg2=’wahhhhh’

cd ../

touch ‘asdf’

ctrl + r

fab

fab some_map_reduce_job:arg1=’ahhhh’,arg2=’wahhhhh’

3. !n:x-y Recall arguments x-y from the last nth command. This is another command that is a great help when running map reduces with complicated argument lists. Though, it is a lot more complicated than the other commands mentioned here, and worth reading about separately. True to the theme of this post, I redirect you to: http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/ for a great resource on this, and will stick to giving a few simple examples.

Example use case(s):

>echo “foobar”

foobar

>echo “moocow”

moocow

>!-2

foobar

>!-2

moocow

--------

cat foo > impossible_to_remember_filename_akj3kj2437fvaj

nano !:3

--------

port install haskell-platform

##oh no, permission failure##

sudo !!

---------

>echo “hi” && echo “why”

hi

>!!:0-1

hi

>!-2:2-$

why

Too lazy to go to work?

Being too lazy to go to work is, of course, never a problem for me. But theoretically, I could see the following scenario occur.

1. While at work, start a ssh tunnel between your work computer and a gateway server. (For details on how we do this, checkout: http://blog.adku.com/2011/06/working-remotely.html)

2. Go home, relax.

3. Start a ssh session to your work server.

4. Start tmux

5. never go to work again.

With the exception of 4 (and 5?), this is probably a familiar process. But here’s the beauty of four:

connection closed by remote host.

Never again.

To quote the tmux man page:

Each session is persistent and will survive accidental disconnection (such as ssh(1) connection timeout) or intentional detaching (with the `C-b d' key strokes).

Aside from never losing your work due to connection problems, Tmux also makes it easy to start a job at work, go home, and continue monitoring that job remotely, or vice versa.

For example:

I start a tmux session at start tailing a random log at work:

To remember this session, I name it by typing

ctrl + b + : rename_session “foo”

Then I go home.

At home, I ssh into my work computer and type

and everything just works!

In addition to creating and naming sessions, tmux makes it easy to create and name panes within sessions. I often find myself running many jobs of the same type, which I like to organize into named panes within a single session.

The panes I have open are called “mo”, “meeny”, and “eeny”. In each screen I am running a different map reduce job. By naming the panes, I’ll remember exactly what I was running in each pane wherever I go.

Basic panel usage:

create

ctrl + b c

delete

ctrl + b x

rename

ctrl + b ,

navigate to previous panel

ctrl + b p

nagivate to next panel

ctrl + b n

navigate to panel #

ctrl + b #

Too lazy to...continue?

53 comments:

  1. Type even less:

    alias -='cd -'
    alias ..='cd ..'

    ReplyDelete
  2. تريد الحصول عليه ونحن نقدم هذه الخدمات بأسعار Sibah ومن خلال فريق مدرب حتى تكون شركة التنظيف في الدمام هي اختيار أفضل العملاء لتنظيف المنازل والقصور والفيلات ، والتي تشمل تنظيف الواجهات الزجاجية وحمامات السباحة والسقوف وكذلك جميع الغرف مثل كغرف معيشة وغرف نوم كما نقدم خدمات تنظيف السجاد وتنظيف المفروشات والأرائك وكل ما تحتاجه معنا.
    شركة النجوم لخدمات التنظيف
    شركة تنظيف فلل بالطائف
    شركة تنظيف مجالس بالطائف
    شركة نقل عفش بالطائف

    ReplyDelete
  3. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.

    www.gumawawebsite.blogspot.com/2019/04/is-it-worth-it-to-buy-old-domain.html

    ReplyDelete
  4. https://coolmathgames.com
    As mentioned before due to the increased access of the internet, the advanced technological graphics used simply make games very addictive.
    https://coolmathgamesz.com

    ReplyDelete
  5. Contact 1800customerservicesnumber to get solutions related to mcafee.com/activate issues or by directly visiting on

    www.mcafee.com/activate or You can just call on +1-888-526-0222 For technical help or any concerned query related to McAfee Product or service , activation

    .You can find easiest solutions to the issues online or offline both .Our Mcafee Antivirus Support Service
    is 24/7 available to help you.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. The best way to locate safe and enjoyable online games now is to access them through social networking websites. The most popular games on Facebook are well known, but there are various other games which you can get through smaller social networking sites that are every bit as fun. Five of those games are presented here. Watch them up and enjoy! Cooler Math GamesCool Math GamesCool Math Games

    Cool Math Games

    Cool Math Games Unblocked Bloons Tower Defense

    Cool Math Games


    Browser Kingdom

    This game designates all players as the Lord of the own country. The goal is to go head-to-head with other Lords so as to benefit their particular country. This is a strategic game that includes fighting and some strategic thinking to push a nation ahead.

    ReplyDelete
  11. You have written such a interesting blog.it is worth of reading.keep updating and sharing with us

    Digit me
    Zen Watson


    ReplyDelete
  12. I never used all the features of MyGarmin Express. But still I can say that this is the best app I have ever used. Garmin Nuvi comes with some refined features. Check out Garmin Nuvi or call +1-888-309-0939 for instant help from Garmin GPS experts.

    Visit the website https://www.garminnuvimapupdate.com/mygarmin-express.php

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Your Verizon Email Not performing on MacBook? Do you want to know How To Fix Verizon Email Not Performing On MacBook? Don’t worry! Our Email Expert 247 team will be help you. They will provide troubleshoot of Verizon Email Not performing on MacBook. You just call on Email Expert 24*7 customer care toll-free number and visit our official website.

    ReplyDelete
  15. This is a very nice one and gives in-depth information. I am really happy with the quality and presentation of the article. I’d really like to appreciate the efforts you get with writing this post. Thanks for sharing.
    Java Training in Chennai

    ReplyDelete
  16. Very nice blog site. Your blog site is very informative and learnable. I think men can be learn in this blog site. Thank you so much for sharing this post with us. Thank's a lot bro, You can visit our site , web development company in Bangladesh

    ReplyDelete

  17. I was lazy in my starting time I have to not complete my work on time so I had to contact Vertical report example service and complete my work. if you are new to college so you can do it. and complete your work

    ReplyDelete

  18. Visit the website if you're curious to learn more about what I previously saw that was unknown. I'd like to see a service that writes student essay writing help because I'll need help with a project in ten days. Visit the website if you're interested in learning more about what I previously saw but didn't know about.

    ReplyDelete
  19. your website is very nice, the article is very enlightening, I wish you continued success. ทางเข้าเล่น joker

    ReplyDelete

  20. Hello! It's a nice time coming around your blog. I have a special joy surfing through your content today. Its interesting and knowledgeable ideas shared. I really appreciate the good work here. federal cooperative college admission form this year

    ReplyDelete
  21. I really appreciate your effort for publishing a remarkable blog post. Your insights are truly inspired. Thanks for sharingsprinkles coupon code

    ReplyDelete
  22. "It's all about working smart, not just hard! Finding the right tools and support, like Alriyady Services, can make a significant difference. Keep pushing forward!

    ReplyDelete
  23. We understand the importance of affordability when it comes to roadside assistance. That's why at nyc towing we're committed to providing affordable solutions to our customers in need

    ReplyDelete
  24. Get body massage in bangalore by ishaspa at low prices. Staffs are friendly in nature even located in calm place so assured relax available.

    ReplyDelete
  25. Amazing, Your blogs are really good and informative. I got a lots of useful information in your blogs. The best way to locate safe and enjoyable online games now is to access them through social networking websites. The most popular games on Facebook are well known, but there are various other games which you can get through smaller social networking sites that are every bit as fun virginia beach dui lawyer. It is very great and useful to all. Keeps sharing more useful blogs,.,.

    ReplyDelete
  26. TCS Courier Tracking is a user-friendly service that allows customers to monitor the status of their shipments in real-time. By providing detailed updates and accurate tracking information, it ensures transparency and peace of mind for senders and recipients alike.

    ReplyDelete
  27. TCS Ghotki offers dependable courier and logistics services to the Ghotki region in Pakistan, ensuring prompt and secure deliveries. With a focus on customer satisfaction, TCS Ghotki provides efficient solutions for both individual and business shipping needs.

    ReplyDelete
  28. SNGPL Duplicate Bill service allows customers to obtain a copy of their gas utility bill from Sui Northern Gas Pipelines Limited if they have lost or misplaced the original. This service ensures easy access to billing information for timely payment and record-keeping.

    ReplyDelete
  29. In ISO 9001, addressing external issues ISO 9001 examples involves identifying and managing factors that can impact an organization's quality management system. Examples of external issues include market trends, economic shifts, and regulatory changes, which must be considered to ensure the QMS remains effective and aligned with the organization's goals.

    ReplyDelete
  30. The Sui Gas bill check service allows customers to easily view their gas bill details online, ensuring they can track usage and manage payments efficiently. This tool simplifies the billing process and helps prevent late payments by providing quick and convenient access to billing information.

    ReplyDelete
  31. Hardly Working Hard humorously explores the balance between productivity and procrastination, offering relatable anecdotes about struggling to stay motivated. The lighthearted tone makes it an enjoyable read for anyone who feels caught between being busy and actually getting things done. A fun take on modern work-life challenges.
    Falls Church Abogado Criminal
    A lawyer might commonly say, "Let's carefully review all the documents to ensure we're fully informed. It's important to follow the correct legal procedures, so we avoid any potential issues. I'll advise you on the best course of action to protect your interests. Rest assured, your confidentiality is a top priority throughout this process."

    ReplyDelete
  32. To learn how to check gas bill online in Pakistan, customers can visit the official website of their gas provider, such as SNGPL or SSGC. By entering their customer reference number, they can view and download their monthly gas bill easily.

    ReplyDelete
  33. The Cookout menu offers a wide variety of American fast-food favorites, including burgers, hot dogs, BBQ, chicken sandwiches, and wraps. Known for its affordable combo deals, the menu also features sides like fries, hushpuppies, and over 40 flavors of milkshakes. Cookout is popular for its large portions and customizable meal options.

    ReplyDelete
  34. Irony in Effort: The phrase humorously highlights someone appearing to be busy or hard at work, but in reality, they are putting in minimal effort.
    Workplace Humor: It's often used in professional settings to poke fun at procrastination or inefficiency while giving the illusion of productivity.
    virginia traffic lawyer reckless driving

    ReplyDelete
  35. บริการ นำเข้าสินค้าจากจีน สั่งสินค้าจากจีน ขนส่งสินค้าทางเรือ​ ด้วยประสบการณ์ยาวนานนับ 10 ปี ในการนำเข้าสินค้าจากจีน จึงทำให้ THE ONE CARGO เป็นที่ 1 ในใจของผู้นำเข้าหรือร้านค้าพรีออเดอร์จากจีน ด้วยจำนวนเที่ยวเรือที่ออกถี่ จึงทำให้ผู้นำเข้าไม่ต้องรอรอบนาน พร้อมกระจายสินค้าทั่วไทย

    ReplyDelete
  36. The Sonic Shakes menu features a wide selection of creamy, indulgent shakes in flavors like Chocolate, Vanilla, Strawberry, and seasonal varieties. Customers can also customize their shakes with mix-ins like candy, fruit, or nuts, offering a personalized treat experience.

    ReplyDelete
  37. Gold Rate Calculator, designed to simplify your gold pricing needs. Instantly calculate the value of gold across various karats, including 24K, 22K, 21K, and 18K, based on live market rates. Whether you're buying, selling, or just estimating, our calculator offers accurate results tailored for Kuwait’s market. Make smarter decisions with just a few clicks!

    ReplyDelete
  38. A gas duplicate bill allows customers to easily obtain a copy of their original gas bill in case it is lost or misplaced. This service can typically be accessed online through the utility provider's website by entering the account details or previous bill information.

    ReplyDelete