Skip to content

Instantly share code, notes, and snippets.

@jylock
jylock / Hadoop Commands
Last active October 13, 2015 18:35
Compile, ToolRunner, Configuration, etc
#TF-IDF
TF-IDF = tf * idf = tf * log(N/n)
tf: number of times a term appears in a document
N: total number of documents
n: number of documents that contain a term
TF-IDF stands for "Term Frequency, Inverse Document Frequency".
It is a way to score the importance of words (or "terms") in a
document based on how frequently they appear across multiple documents.
redirect.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
/**
* Executes the command "grep Villanova < scores > out".
@jylock
jylock / Shell customization
Last active January 16, 2016 05:21
Terminal prompt customization, Alias, etc
Login shell: .bash_profile
Interactive shell: .bashrc
To color code your prompt on a Mac, use the following template:
\[\033[COLOR_CODE_HERE\]PROMPT_ESCAPE_OR_TEXT_HERE\[\033[0m\]
----------------------------------------------------------------------------
Most Linux distributions use a little different format:
\e[COLOR_CODE PROMPT_ESCAPE\e[0m
----------------------------------------------------------------------------
@jylock
jylock / c arrow operator
Last active September 27, 2015 17:09
Arrow Operator Syntax, usage, clarification, etc
struct foo
{
int x;
float y;
};
struct foo var;
struct foo* pvar;
var.x = 5;