Skip to content

Instantly share code, notes, and snippets.

View Grigore147's full-sized avatar

Grigore Dutcovici Grigore147

View GitHub Profile
@Grigore147
Grigore147 / algorithms.js
Created July 7, 2020 02:00 — forked from mmontes11/algorithms.js
JS algorithms
// Remove duplicates from an array
(function() {
Array.prototype.unique = function() {
return Array.from(new Set(this));
};
console.log([1, 2, 3, 4, 4, 5].unique()); // [1, 2, 3, 4, 5]
})();
// Memoized function
(function() {
@Grigore147
Grigore147 / nginx.conf
Created January 31, 2019 22:06 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@Grigore147
Grigore147 / gist:5749039
Created June 10, 2013 14:19
Download and extract tarballs
var request = require('request');
var zlib = require('zlib');
var tar = require('tar');
var url = 'https://github.com/Shogun147/Katana/tarball/master';
var path = __dirname + '/katana';
request({ url: url }).pipe(zlib.createUnzip()).pipe(tar.Extract({ path: path }))
.on('end', function() {
console.log('Done!');
@Grigore147
Grigore147 / request.js
Created January 23, 2013 18:07
HTTP Response pause/resume
var Http = require('http');
var Fs = require('fs');
// some url to big video file
var url = 'url';
var path = 'save_path';
var downloaded = 0;
var percents = 0;
var size = 0;