Skip to content

Instantly share code, notes, and snippets.

View mohnish's full-sized avatar

Mohnish Thallavajhula mohnish

View GitHub Profile
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

SELECT b.name as bill, c.name as category, p.amount as amount, ps.name as card, ps.type as card_type
FROM payments as p, bills as b, categories as c, payment_sources as ps
WHERE b.user_id = 1 AND p.bill_id = b.id AND ps.id = p.payment_source_id AND c.id = b.category_id
;
SELECT b.name as bill, c.name as category, p.amount as amount, ps.name as card, ps.type as card_type
FROM bills as b
INNER JOIN payments as p
ON p.bill_id = b.id
INNER JOIN categories as c
@mohnish
mohnish / diff.txt
Created April 7, 2015 06:09
diff a file from a different branch
git diff <branch_name> -- /path/to/file/in/repo
@mohnish
mohnish / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@mohnish
mohnish / console
Last active August 29, 2015 14:18 — forked from olslash/console
var externalObj = {key: 'value'};
var items = {
obj: {
'string prop': 'string val',
5: 10,
nested: [[3, [5, 2]]],
'function': function(){return true;},
reference: externalObj
},
@mohnish
mohnish / typewriter.js
Created March 31, 2015 20:10
typewriter.js
var text = "mohnish".split('');
var i = 0;
var curr = text[i];
var input = document.querySelector('your-selector');
var id = setInterval(function() {
input.value = curr;
i++;
curr += text[i];
if (i == text.length) window.clearInterval(id);
}, 500);

Keybase proof

I hereby claim:

  • I am mohnish on github.
  • I am mohnish (https://keybase.io/mohnish) on keybase.
  • I have a public key whose fingerprint is FC17 4AF7 7A4E 4A42 CC8E 88BE F40C 483A 2140 8E2D

To claim this, I am signing this object:

Linux Backup Solutions

I've been looking for the best Linux backup system, and also reading lots of HN comments.

Instead of putting pros and cons of every backup system I'll just list some deal-breakers which would disqualify them.

Also I would like that you, the HN community, would add more deal breakers for these or other backup systems if you know some more and at the same time, if you have data to disprove some of the deal-breakers listed here (benchmarks, info about something being true for older releases but is fixed on newer releases), please share it so that I can edit this list accordingly.

  • It has a lot of management overhead and that's a problem if you don't have time for a full time backup administrator.

1. SYSTEM

$ uname –a                          # Display linux system information
$ uname –r                          # Display kernel release information (refer uname command in detail)
$ hostname                          # Show system host name
$ hostname -i                       # Display the IP address of the host (all options hostname)
$ uptime                            # Show how long system running + load (learn uptime command)
$ last reboot                       # Show system reboot history (more examples last command)
$ cat /etc/redhat_release           # Show which version of redhat installed 

$ date # Show the current date and time (options of date command)