hi, my name is Ian Scrivener. I'm an Australian web technology specialist, fullstack/backend javascript web developer & cloud sysadmin. I've extensive (23 years) experience with medium to large scale web projects for .com, .gov & .org.

My main weapons include javascript; node.js, angular.js, d3.js and mean.js, with SQL & noSQL databases; mySQL, PostgresSQL, MSSQL, MongoDB, CouchDB, redis etc

... find out more


SSH shell & SFTP on Windows to an Ubuntu server

SSH shell & SFTP on Windows to an Ubuntu server


Open firewall ports

only 3 ports are open to the public, limiting attack vectors 80 - http.. web traffic 443 - https.. secure web traffic 22 - SSH.. command line connection, tunnelling & file trasfers (SFTP)


Setup SSH on Ubuntu

apt-get install openssh-server


Setup SSH on Windows

Purchase Bitvise SSHD & follow their online instructions

Clientside Setup (Windows)


Filezilla - file transfers

.. extremely simple/intuitive.. see Filezilla online docs if you're stuck


SecureRT - command line & ad hoc tunneling

Buy the software - http://www.vandyke.com/products/securecrt/


Bitvise Tunnelier - persistant tunneling

Comments

manually installing mean.js Yeoman generator in npm global

# remove Yo generator from npm global
sudo npm remove generator-meanjs -g
sudo npm cache clean -g


# figure out where my npm files are
npm root -g
>>/usr/lib/node_modules


# cd to the npm global directory
cd /usr/lib/node_modules
ls
>>bower grunt-cli  gulp  http-server nodemon npm  yo


# get the latest Yo generator code from GitHub
sudo git clone https://github.com/meanjs/generator-meanjs
cd generator-meanjs

# switch to the 0.4-dev branch
sudo git checkout origin/0.4-dev

# install any generator-meanjs dependencies to global
sudo npm update -g


cd ~/
# test it
mkdir tmp
cd tmp
yo meanjs:vertical-module my_crud_module

Ian Scrivener http://ianscrivener.com

Comments

grunt exec with callback

Highlighting grunt exec with callback. Another one for grunt geeks only... so no apologies for source code only approach.

    exec: {            
        //get IP & Set a local variable
        get_ip: {
            command: 'ifconfig | grep -m 1 "inet addr:192.168.1" | cut -c21-31',
            callback: function (error, stdout, stderr) {
                if (error !== null) {
                    grunt.log.error('exec error: ' + error);
                };
                globalConfig.myIP = stdout;
                console.log('set myIP:', globalConfig.myIP);
            },
            stdout: false,
            stderr: false            
        }
    }
Comments

grunt: browser open and reload with ip instead of localhost

This one is for grunt geeks only... so no apologies for source code only approach.

Why not use localhost? Because often I use Chome To Mobile to push a website I'm working on for review to my tablet or mobile.. so localhost just ain't good enough.

module.exports = function (grunt) {

    // set a default url to locahost
    var globalConfig = {
        myIP: "localhost"
    };


    grunt.initConfig({

        // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
        // set the globals
        globalConfig: globalConfig,

        // not sure why the following wou=ldn't work
        //var globalConfig = {myIP: "localhost"};


        // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
        // execute to CLI
           exec: {

                //get IP & Set a local variable
                get_ip: {
                    command: 'ifconfig | grep -m 1 "inet addr:192.168.1" | cut -c21-31',
                    callback: function (error, stdout, stderr) {
                        if (error !== null) {
                            grunt.log.error('exec error: ' + error);
                        };
                        globalConfig.myIP = stdout;
                        console.log('set myIP:', globalConfig.myIP);
                    },
                    stdout: false,
                    stderr: false

                }
            },


            // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
            // start local development websever   
            connect: {
                wwwroot: {
                    options: {
                        port: 5001,
                        hostname: '*',
                        base: 'wwwroot',
                        livereload: true
                    }
                }
            },

            // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
            // open the dev site in the browser 
            open: {
                wwwroot: {
                    path: 'http://<%= globalConfig.myIP %>:5001'
                }

            },

            // &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
            // watch for files changes and trigger various actions when they occurs
            watch: {
                wwwroot: {
                    files: ['wwwroot/**'],
                    options: {
                        livereload: true
                    }
                }
            }            
    });


    grunt.registerTask('default', [', 'connect', 'exec:get_ip', 'open:wwwroot','watch']);

    // this is a must Grunt add-on. 
    // It saves you installing all the grunt add-ons in node one-by-one
    // just do node install: 'npm install --save-dev load-grunt-tasks' 
    // and include this simple line
    require('load-grunt-tasks')(grunt);
};
Comments