Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@saggiyogesh
saggiyogesh / update_npm_packages.md
Last active January 2, 2016 13:59
Updating packages in package.json

Execute following commands.

npm install -g npm-check-updates

ncu -u

npm install

sudo add-apt-repository ppa:libreoffice/ppa

sudo apt-get update

sudo apt-get install libreoffice

Install sun java 8 on ubuntu

@saggiyogesh
saggiyogesh / Docker file sync.md
Last active June 12, 2016 14:20
Docker file sync when host directory is mounted in docker container, so that hot reloading will work.

Using docker containers in Windows(host) for react and webpack so that workspace has linux like feel. To do so mounting the workspace directory in container, so coding is done in atom on Windows while server is running in docker. But issue is that changes done in host folder files are not reflected and not reloaded by webpack, so created a small trick to reload changes by webpack.

Include above 2 files in project, and install the required dependencies by these files. fileWatcherLocal.js will listen the change on Windows and same it'll notify to the fileWatcherServer.js server. fileWatcherServer.js listen the changed file path sent by fileWatcherLocal.js and executes chmod command to notify webpack.

fileWatcherLocal.js must be run in host (my case Windows).

@saggiyogesh
saggiyogesh / mongo_dump_restore.md
Last active December 3, 2020 18:26
Mongodb dump and restore from mlab
  • install mongodb on local machine (mongodump & mongorestore) commands are required.
  • command dumping

mongodump -h xxx11.mlab.com:11 -u user -p password --authenticationDatabase release-db -d release-db -o /home/dumps

**Options** `-h`: mlab host:port, `-u`: db user, `-p`: db user password, `--authenticationDatabase` `-d`: mlab dbname, `-o`: path to store backupfiles
  • restore command, to restore locally

    mongorestore --db dname /home/dumps

Otherwise to restore in mlab, create a new db and replace the options

@saggiyogesh
saggiyogesh / .eslintrc
Created July 21, 2016 07:25 — forked from cheton/.eslintrc
ESLint
{
"plugins": [
"react"
],
"extends": "airbnb",
"env": {
"browser": true,
"node": true,
"es6": true
},
@saggiyogesh
saggiyogesh / nginxproxy.md
Created September 22, 2016 18:44 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@saggiyogesh
saggiyogesh / customer.js
Last active October 15, 2016 14:21
Loopback create computed props from other props.
module.exports = function (Customer) {
Customer.getter['fullname'] = function () {
return `this.firstName this.lastName`.trim()
};
};
@saggiyogesh
saggiyogesh / install-docker-master.sh
Created March 6, 2017 08:24 — forked from alexellis/install-docker-master.sh
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
#!/bin/sh
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
# renames the host to have a suffix of alexellisio
export original=$(cat /etc/hostname)
sudo hostname $original-master-alexellisio
echo $original-master-alexellisio | sudo tee /etc/hostname
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@saggiyogesh
saggiyogesh / install.md
Created July 5, 2017 11:06
3 Steps to install latest node & npm on Ubuntu.
  • sudo apt-get install npm
  • sudo npm i -g n
  • sudo n latest
  • node -v
@saggiyogesh
saggiyogesh / portainer.sh
Created October 30, 2017 08:10
portainer
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --restart always portainer/portainer -H unix:///var/run/docker.sock