Skip to content

Instantly share code, notes, and snippets.

@rakeshtembhurne
rakeshtembhurne / import_export_gz.sql
Created July 15, 2013 08:40
MySQL: Import and export in gzip form
// Export database in gzip form
mysqldump -u user -p database | gzip > database.sql.gz
// Import database from gzip form
gunzip < database.sql.gz | mysql -u user -p database
@thinrhino
thinrhino / tf-idf.py
Created May 5, 2014 13:09
Calculate tf-idf
# ref: http://www.tfidf.com/
# Example:
# Consider a document containing 100 words wherein the word cat appears 3 times.
# The term frequency (i.e., tf) for cat is then (3 / 100) = 0.03. Now, assume we
# have 10 million documents and the word cat appears in one thousand of these.
# Then, the inverse document frequency (i.e., idf) is calculated as log(10,000,000 / 1,000) = 4.
# Thus, the Tf-idf weight is the product of these quantities: 0.03 * 4 = 0.12.
#
# Hence:
# 1. Calculate term frequency
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();