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
| // run with any node version (should try with latest one) | |
| // before run we need to install library first | |
| // $ npm install express | |
| var express = require('express') | |
| var app = express() | |
| app.get('/hello/:name', function(req, res){ | |
| var name = req.params.name | |
| var result = { |
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
| # generate key -with password | |
| openssl genrsa -des3 -out server.key 2048 | |
| # generate CSR for ssl certificate provider | |
| openssl req -nodes -sha256 -new -key server.key -out server.csr | |
| # remove password phase | |
| cp server.key server.key.org | |
| openssl rsa -in server.key.org -out server.key |
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
| # man ab to see options | |
| ab -n 20 -c 5 -p post.txt -v 4 -T 'application/x-www-form-urlencoded' http://localhost:3000 |
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
| repl = require 'repl' | |
| vm = require 'vm' | |
| coffee = require 'coffee-script' | |
| process.on 'uncaughtException', error | |
| module.exports = -> | |
| # x = vm.runInThisContext 'User = mongoose.model("User")' # because mongoose already declared in global | |
| # console.log x | |
| repl.start '> ', process, (code, context, file, callback) -> |
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
| <script> | |
| // Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful | |
| // Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it. | |
| // The following will allow remote autocompletes *without* modifying any officially released core code. | |
| // If others find ways to improve this, please share. | |
| var autocomplete = $('#searchinput').typeahead() | |
| .on('keyup', function(ev){ | |
| ev.stopPropagation(); |
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
| # ssh autocomplete, please make a file named .ssh_servers in your ~/ | |
| # copy these lines into your .bash_profile | |
| _ssh_server_list() | |
| { | |
| cur=${COMP_WORDS[COMP_CWORD]}; | |
| local names=$(for x in `cat ~/.ssh_servers | grep "^[^# ]"`; do echo ${x} ; done ) | |
| COMPREPLY=( $(compgen -W "${names}" -- ${cur}) ) | |
| } | |
| complete -F _ssh_server_list ssh |