background preloader

$ cheat git

$ cheat git

Don't write on the whiteboard :: Joseph Perla I recently interviewed at a major technology company. I won't mention the name because, honestly, I can't remember whether I signed an NDA, much less how strong it was. I did well. 1. When I interviewed at Palantir around 5 years ago, I had a lot of trouble with this. Most people think you have to write on the whiteboard. The interviewer started by asking me to code up a simple recursive calculation, using any language I wanted. The interviewers don't care. 2. So I asked for some paper and a pen. You should always have paper and pen anyway to write down ideas. Some of the best programmers figure out the high-level overview on paper before they write a single line of new code. 3. Even if you are a C++ systems guru. You will waste a lot of time writing string manipulation code and initialization code that you can do in one line of Python. All I had was a post-it note, a tiny amount of space. 4. Five minutes later, I had my algorithm. 5. 6. Read random Wikipedia articles. 7. 8. 9. 10. 11.

gitignore $ command line cheat sheets git - Change repo name in github Backups Via GIT: gibak « Ivor O’Connor Backups Via GIT: gibak Trying not to reinvent the wheel a quick google was done. Lucky thought on my part because somebody else has already made an application for this purpose called “gibak“. Here’s what the author says: * it is more space-efficient than most incremental backup schemes, since it does file compression and both textual *and* binary deltas (in particular, it’s better than solutions relying on hardlinks or incremental backups à la tar/cpio) * its transport mechanism is more efficient than rsync’s * it is fast: recoving your data is *faster* than cp -a * you keep the full revision history * powerful toolset with a rich vocabulary So what’s the catch? I played with it for quite some time but for some reason it would archive over 8GBs, which is all the space I currently have left on this laptop, and die. Like this: Like Loading... No comments yet.

Java Anti-Patterns This page collects some bad code that may not look so obviously bad to beginners. Beginners often struggle with the language syntax. They also have little knowledge about the standard JDK class library and how to make the best use of it. In fact I have collected all examples from everyday junior code. I have modified the original code to give it example character and such that it highlights the problems. Many of these problems can easily be detected by SonarQube. Some of these may seem like micro-optimization, premature optimization without profiling or constant factor optimizations. If you are interested in how to pogram compiler friendly, look at the JDK Performance Wiki. In the end a lot of your application's performance depends on the overall quality of your code. Compare these scenarios (assume 100MB young generation): In the slower scenario the transaction duration is 10 times longer. String concatenation This is a real memory waster. Lost StringBuffer performance String name = ...

Git Reference Git - Fast Version Control System Intro to Distributed Version Control (Illustrated) Traditional version control helps you backup, track and synchronize files. Distributed version control makes it easy to share changes. Done right, you can get the best of both worlds: simple merging and centralized releases. Distributed? What’s wrong with regular version control? Nothing — read a visual guide to version control if you want a quick refresher. Centralized VCS emerged from the 1970s, when programmers had thin clients and admired “big iron” mainframes (how can you not like a machine with a then-gluttonous 8 bits to a byte?). Centralized is simple, and what you’d first invent: a single place everyone can check in and check out. This model works for backup, undo and synchronization but isn’t great for merging and branching changes people make. Sure, merging is always “possible” in a centralized system, but it’s not easy: you often need to track the merge yourself to avoid making the same change twice. A Few Diagrams, Please Distributed Version Control Systems (DVCS) Core Concepts

Git Delete Last Commit Once in a while late at night when I ran out of coffee, I commit stuff that I shouldn't have. Then I spend the next 10 - 15 minutes googling how to remove the last commit I made. So after third time I wanted to make a record of it so I can refer to it later. If you have committed junk but not pushed, git reset --soft HEAD~1 HEAD~1 is a shorthand for the commit before head. If you want to get rid of any changes to tracked files in the working tree since the commit before head use --hard instead. Now if you already pushed and someone pulled which is usually my case, you can't use git reset. git revert HEAD This will create a new commit that reverses everything introduced by the accidental commit.

Vimcasts - free screencasts about the text editor Vim jsmits/github-cli Sending Email with Perl Best Practice by Frank Wiles Forward If you are a spammer or otherwise send unsolicited bulk Email, please stop reading this article now. This article has been specially crafted to work poorly for spamming*. Do everyone on the Internet a favor and find another way of making your living. Intro One of the best things about programming in Perl is that there is more than one way to do it ( aka TIMTOWTDI ), but the sheer number of available options often confuses new programmers. There are about 937 different ways to send Email with Perl. shelling out to /usr/sbin/sendmail writing my own in-house modules using Net::SMTP directly when the application did not need to send attachments using MIME::Lite when I did need to include attachments But as anyone who has been involved with Perl for awhile knows, it's a good idea to re-evaluate your current practices to see if a better tool or technique has been developed since last time you researched it. It allows you to: Why use templates for Email? test.txt.tt Conclusion

Related: