Skip to content

Instantly share code, notes, and snippets.

View geega's full-sized avatar
🇺🇦

Svyatoslav Varpikhovsky geega

🇺🇦
View GitHub Profile
@geega
geega / int2alphaNumber.js
Created April 6, 2019 08:59
Long integer value to alphabet and number via Javscritp
var n = 1234567890;
alert( n.toString(36) ); // kf12oi
@geega
geega / isNumeric.js
Created April 6, 2019 08:55
Check whether a value is a number in JavaScript
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
@geega
geega / mongo-export.sh
Created March 17, 2019 14:39
Mongo export command line
mongoexport --host 127.0.0.1 -d database_name -c collection_name --port 27017 --limit=1000000 --vvvvvv --out /full/path/to/file.json
@geega
geega / find.php
Created February 10, 2019 15:28
Simple algorithm for find time pick events
<?php
$data = [
'2019-02-01 10:00:00',
'2019-02-01 10:01:00',
'2019-02-01 10:02:00',
'2019-02-01 10:03:00',
'2019-02-01 10:04:01',
'2019-02-01 10:04:25',
@geega
geega / change-hostname.md
Created February 3, 2019 12:39
How to Change Hostname (Computer Name) in Ubuntu 1804

Сhange hostname file

sudo nano /etc/hostname

Change name

ubuntu18-laptop

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

Steps:

  1. Open VirtualBox
  2. Right-click your VM, then click Settings
  3. Go to Shared Folders section
  4. Add a new shared folder
  5. On Add Share prompt, select the Folder Path in your host that you want to be accessible inside your VM.
@geega
geega / bakup-restore-docker-image.sh
Created January 27, 2019 07:35
Backup/restore docker image for deployment
# Backup to tgz file
$ docker save myusername/myproject:latest | gzip -c > myproject_img_bak20190103.tgz
# Restore from file
$ gunzip -c myproject_img_bak20190103.tgz | docker load
@geega
geega / nodejs-simple-copy-file-fs-extra.es6
Created November 25, 2018 10:35
NodeJS, Simple copy file by fs-extra module
const fs = require('fs-extra')
fs.copy('dbDump.zip', 'dbDumpCopy.zip')
.then(() => console.log('File was successfully copied!'))
.catch(err =>console.error)
@geega
geega / nodejs-simple-copy-file.es6
Created November 25, 2018 10:34
Simple copy file by NodJS
const fs = require('fs');
fs.createReadStream('dbDump.zip').pipe(fs.createWriteStream('dbDumpCopy.zip'));
@geega
geega / nodejs-md5-hash.es6
Created November 25, 2018 10:33
String to MD5 hash by nodejs
let message = "I love node";
const crypto = require('crypto');
let hashed=crypto.createHash('md5').update(message).digest("hex");