#elasticsearch Crash Course!
- A way to search... things
- A way to search your data in terms of natural language, and so much more
- A distributed version of lucene with a JSON API.
- A fancy clustered database
| #!/bin/bash | |
| FAIL=0 | |
| echo "starting" | |
| ./sleeper 2 0 & | |
| ./sleeper 2 1 & | |
| ./sleeper 3 0 & | |
| ./sleeper 2 0 & |
| #!/bin/bash | |
| # Functions ============================================== | |
| # return 1 if global command line program installed, else 0 | |
| # example | |
| # echo "node: $(program_is_installed node)" | |
| function program_is_installed { | |
| # set to 1 initially | |
| local return_=1 |
| #!/usr/bin/env node | |
| 'use strict'; | |
| var spawn = require('child_process').spawn; | |
| var args = [ | |
| '--harmony', | |
| 'app/bootstrap.js' | |
| ]; |
| // Restify Server CheatSheet. | |
| // More about the API: http://mcavage.me/node-restify/#server-api | |
| // Install restify with npm install restify | |
| // 1.1. Creating a Server. | |
| // http://mcavage.me/node-restify/#Creating-a-Server | |
| var restify = require('restify'); |
We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.
This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):
async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.| #!/usr/bin/env python | |
| import argparse,collections,json,shlex,urllib,re | |
| from datetime import datetime | |
| from datetime import timedelta | |
| from dateutil.parser import parse | |
| from termcolor import colored | |
| # Command line arguments | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--dry-run", dest="dryrun", action="store_const", const=True, default=False, help="Do not delete SonarQube projects.") |
| #!/bin/bash | |
| set -e | |
| function ynprompt { | |
| read -n 1 -r -p "KEEP GOING? [Y/n] " response | |
| if [[ $response =~ ^([nN])$ ]] | |
| then | |
| exit | |
| fi |
| /******************************************************************************* | |
| * Copyright (c) 2017 Nicola Del Gobbo | |
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
| * use this file except in compliance with the License. You may obtain a copy of | |
| * the license at http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
| * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY | |
| * IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | |
| * MERCHANTABLITY OR NON-INFRINGEMENT. |
| # Uncomment to print commands being executed | |
| # set -x | |
| pid=0 | |
| # SIGTERM-handler | |
| term_handler() { | |
| echo "Handler INT"; | |
| if [ $pid -ne 0 ]; then | |
| kill -SIGTERM "$pid" | |
| wait "$pid" |