This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ npm install -g loopback-cli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ lb | |
| ? What's the name of your application? hello-world | |
| ? Enter name of the directory to contain the project: hello-world | |
| ? Which version of LoopBack would you like to use? 3.x (current) | |
| ? What kind of application do you have in mind? hello-world (A project containing a controller, | |
| including a single vanilla Message and a single remote method) | |
| ... | |
| I'm all done. Running npm install for you to install the required dependencies. | |
| If this fails, try running the command yourself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Be sure to run "npm install request" in this directory | |
| // before running this script | |
| var request = require('request'); | |
| request('http://www.cjs.vn/', function(error, response, body) { | |
| if (!error && response.statusCode === 200) { | |
| console.log(body); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var count = 2; | |
| var doIt = function(i, callback) { | |
| callback(null, i * 2); | |
| } | |
| module.exports.doIt = doIt; | |
| module.exports.foo = 'bar'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var os = require('os'); | |
| var toMb = function(f) { | |
| return(Math.round((f/1024/1024)*100)/100); | |
| } | |
| console.log('Host: ' + os.hostname()); | |
| console.log('15 min. load average: ' + os.loadavg()[2]); | |
| console.log(toMb(os.freemem()) + ' of ' + toMb(os.totalmem()) + ' Mb free'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # generated from http://pgtune.leopard.in.ua/ | |
| max_connections = 1000 | |
| shared_buffers = 6GB | |
| effective_cache_size = 18GB | |
| work_mem = 6291kB | |
| maintenance_work_mem = 1536MB | |
| min_wal_size = 2GB | |
| max_wal_size = 4GB | |
| checkpoint_completion_target = 0.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install virtualenv python-pip libpq-dev python-dev | |
| cd | |
| virtualenv pgadmin4 | |
| cd pgadmin4 | |
| source bin/activate | |
| pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.6/pip/pgadmin4-1.6-py2.py3-none-any.whl | |
| echo "SERVER_MODE = False" >> lib/python2.7/site-packages/pgadmin4/config_local.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DATABASE_POOL_ARGS = { | |
| 'max_overflow': os.environ.get('max_overflow', 220), #please don't remove this. | |
| 'pool_size': os.environ.get('pool_size', 28), | |
| 'recycle': 300 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // url_to_drive.gs | |
| // Google Apps Script | |
| // Allows uploading a URL directly to Google Drive. | |
| // | |
| // Live link: | |
| // https://script.google.com/macros/s/AKfycbzvhbHS4hnWPVBDHjQzZHA0qWq0GR-6hY7TbYsNto6hZ0MeAFZt/exec | |
| // | |
| // Source-code: | |
| // https://gist.github.com/denilsonsa/8134679 | |
| // https://script.google.com/d/1Ye-OEn1bDPcmeKSe4gb0YSK83RPMc4sZJt79SRt-GRY653gm2qVUptoE/edit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |