Skip to content

Instantly share code, notes, and snippets.

View fariszacina's full-sized avatar
💭
Hacking Remotely

Faris Zacina fariszacina

💭
Hacking Remotely
View GitHub Profile
@fariszacina
fariszacina / designdecisionsstartup.md
Created May 13, 2018 21:29
Design Decisions - Startup MVP

Project MVP - Design Decisions - a.k.a. Why?

This is a list of design decisions to support the MVP of our product.

Maintainability

  • We prioritize productivity and time to market, so we plan to use Rails since the team is familiar with the technology even if it might be suboptimal.
  • Skip automated tests because of lack of time and money for the MVP

Scalability

  • We expect from 500-2000 active users using our systems daily. This should be easily achievable with a modest deployment in Google Cloud and Kubernetes.
@fariszacina
fariszacina / designdecisions.md
Last active May 13, 2018 21:13
Design Decisions - Node.js

Node.js Design Decisions - a.k.a. Why?

This is a list of design decisions to support version 0.2 of the Node.js library

Maintainability

  • We want to make it simple to work with asyncronous IO
  • No function should direct perform I/O. Use callbacks instead
  • Have built in support for important protocols (TCP, DNS, HTTP) and support many HTTP features (chunked requests, keep alive, comet etc.)
  • The API should be both familiar to client-side JS programmers and old school UNIX hackers.
  • Be platform / operating-system independent
  • Reuse solid platforms (Google V8) and minimize dependencies (python only)
export function bookApartment(req, res, next) {
try {
let data = await booking.create(req.booking);
let result = await notifier.sendBookingConfirmation(data));
await statistics.log(result));
await log.debug('booking-succeeded');
res.send(200);
} catch(err) {
next(err)
}
@fariszacina
fariszacina / promise-pyramid-of-doom-resolved.js
Last active November 4, 2015 10:45
Promise Pyramid of Doom - Resolved
export function bookApartment(req, res, next) {
booking
.create(req.booking)
.then((data) => notifier.sendBookingConfirmation(data))
.then((result) => statistics.log(result))
.then(() => log.debug('booking-succeeded'))
.then(() => res.send(200))
.catch((err) => next(err))
.done();
}
@fariszacina
fariszacina / promise-pyramid-of-doom.js
Last active November 4, 2015 10:25
Promise pyramid of doom
export function bookApartment(req, res, next) {
booking
.create(req.booking)
.then(function(data){
notifier.sendBookingConfirmation(data)
.then(function(result){
statistics.log(data)
.then(function(result){
log.debug('booking-succeeded');
})
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var Exemplar = (function () {
function Exemplar() {
_classCallCheck(this, Exemplar);
}
var Exemplar = (function () {
function Exemplar() {
}
Exemplar.prototype.render = function () {
console.log('hello world');
};
return Exemplar;
})();
class Exemplar {
render() {
console.log('hello world')
}
}
@fariszacina
fariszacina / nmap-scan-advanced.js
Created March 15, 2015 22:33
Node NMAP scan with additional settings
var scanner = require('node-libnmap')
var opts = {
range: ['127.0.0.1', '192.168.0.1/24'],
nmap: '/usr/local/bin/nmap',
scripts: '/usr/local/bin/nmap/scripts/',
flags: '-p 8080 -oG -'
}
scanner.nmap('scan', opts, function(err, report) {
@fariszacina
fariszacina / nmap-scan.js
Last active August 29, 2015 14:17
Node NMAP scan using libnmap
var scanner = require('node-libnmap')
var opts = {
range: ['10.0.2.128-255', '10.0.2.0/25', '192.168.0.0/17', '::ffff:192.168.2.15'],
ports: '21,22,80,443,3306,60000-65535'
}
scanner.nmap('scan', opts, function(err, report) {
if (err) console.error(err)
report.forEach(function(item){
console.log(item[0])
})