Blog Spot!


Virtual Box - folder sharing

  • askubuntu - How to share my folder with my guest Linux machine?
  • askubuntu - How to access host shared folder from Ubuntu guest?

..for free of hassle access to the shared folder: Now add your user to the vboxsf group:

sudo usermod -aG vboxsf $(whoami)

Added on 19.Jan.2019
Tags: vbox share guest virtualbox linux

Node hot reloading certificate after certificate file is changed

var ws = require('ws');
var fs = require('fs');
var https = require('https');

var options = {
    server : https.createServer({
        cert : fs.readFileSync('/path/to/crt'),
        key : fs.readFileSync('/path/to/key'),
    }).listen(2000)
};

var timeout;
fs.watch('/path/to/crt', () => {
    clearTimeout(timeout);
    timeout = setTimeout(() => {
        options.server._sharedCreds.context.setCert(fs.readFileSync('/path/to/crt'));
        options.server._sharedCreds.context.setKey(fs.readFileSync('/path/to/key'));
    }, 1000);
});

new ws.Server(options);

...maybe incited of timeout is better to use _.debaunce

Added on 16.Jan.2019
Tags: node js nodejs certificates ssl lets-encript

Node JS script to clean old files in a directory

Anything older than 7 days should be deleted.!

const fs = require('fs');
const path = require('path');
const dirname = path.join(__dirname, 'files');

const files = fs.readdirSync(dirname);
const ms1Day = 24*60*60*1000;

files.forEach(file => {
  const filePath = path.join(dirname, file);
  fs.stat(filePath, (err, stats) => {
    if (err) throw err;

    if ((Date.now() - stats.mtime.getTime() > 7*ms1Day)) {
      fs.unlink(filePath, (err) => {
        if (err) throw err;
        console.log(`deleted ${filePath}`);
      });
    }
  });
});

pluralsight jscomplete/advanced-nodejs course files

Added on 11.Jan.2019
Tags: js node nodejs unix linux cli clean logs

Best IP Geolocation API?

medium

List of Contents

  • IPData.co
  • Maxmind GeoIP2 Precision Service
  • IPInfo.io
  • IP-API.com <- good and free!
  • ipapi.co
  • ipstack.com
  • db-ip.com
  • ipify.org

Added on 01.Jan.2019
Tags: api free ip geolocation

Simple and fast UUID in PHP

Added on 31.Dec.2018
Tags: php uuid code fast

Search


PHP Libraries


Carbon lib / docs
Idiorm lib / docs
Image Workshop lib / docs
lorenzos/Minixed lib / docs
Parsedown lib / docs
PHP Paginator lib / docs
PHP Redis lib / docs
QrCode lib / docs
Requests lib / docs
Slim lib / docs
Spyc lib / docs
TWIG lib / docs
Upload lib / docs
Validation lib / docs
Zebra Image lib / docs

JS Libraries


AJV lib / docs
BackboneJS lib / docs
Bootstrap Notify lib / docs
C3.js lib / docs
ChartJS lib / docs
FastMD5 lib / docs
HighlightJS lib / docs
jQuery-Storage lib / docs
JS-Cookie lib / docs
Leaflet JS lib / docs
LowDB lib / docs
Marked lib / docs
NeedlyJS lib / docs
ParcelJS lib / docs
RequireJS lib / docs
Swig lib / docs
Toastr lib / docs
Underscore lib / docs
ValidateJS lib / docs
top