Skip to content

Instantly share code, notes, and snippets.

View bgruszka's full-sized avatar

Blazej Gruszka bgruszka

View GitHub Profile
These weights are often combined into a tf-idf value, simply by multiplying them together. The best scoring words under tf-idf are uncommon ones which are repeated many times in the text, which lead early web search engines to be vulnerable to pages being stuffed with repeated terms to trick the search engines into ranking them highly for those keywords. For that reason, more complex weighting schemes are generally used, but tf-idf is still a good first step, especially for systems where no one is trying to game the system.
There are a lot of variations on the basic tf-idf idea, but a straightforward implementation might look like:
<?php
$tfidf = $term_frequency * // tf
log( $total_document_count / $documents_with_term, 2); // idf
?>
It's worth repeating that the IDF is the total document count over the count of the ones containing the term. So, if there were 50 documents in the collection, and two of them contained the term in question, the IDF would be 50/2 = 25. To be accurate, we s
@bgruszka
bgruszka / global-gitignore.md
Created July 15, 2018 09:07 — forked from subfuzion/global-gitignore.md
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
  • vagrant up

  • vagrant ssh

  • sudo -i

  • pip install ansible

  • pip install lxc-python2

  • lxc-create -n db1 -t ubuntu

  • lxc-start -n db1 -d

  • lxc-create -n web1 -t ubuntu

# Our .tmux.conf file
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -s escape-time 1
# Ensure that we can send Ctrl-A to other apps
bind C-a send-prefix
@bgruszka
bgruszka / accordion.html
Last active October 19, 2017 06:42
Bootstrap - JS Components
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Element 1
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
@bgruszka
bgruszka / index.html
Last active October 3, 2017 06:38
push left menu using HTML + CSS only
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Push left menu</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
@bgruszka
bgruszka / index.html
Created October 3, 2017 05:35
RWD slide menu using only HTML + CSS
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Only Navigation Menu</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<label for="show-menu" class="show-menu">Show Menu</label>
@bgruszka
bgruszka / sudoku_solver.py
Created July 2, 2017 09:25
sudoku solver using backtracking algorithm
def print_grid(grid):
for i in range(9):
for j in range(9):
print(grid[i][j], end="")
print('\n')
def find_empty_location(grid):
for row in range(9):
for column in range(9):
if grid[row][column] == 0:
@bgruszka
bgruszka / gist:487d6e0ad12e39b5251952f1a8ac6285
Created August 31, 2016 07:02 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch