See also:
| Service | Type | RAM | Storage | Limitations |
|---|---|---|---|---|
| 👉 Adaptable | PaaS | 256 MB | Non-persistent? (1 GB database storage available) | |
| AWS EC2 | IaaS | 1 GB |
| /* | |
| * A simple example of json string parsing with json-c. | |
| * | |
| * clang -Wall -g -I/usr/include/json-c/ -o json_parser json_parser.c -ljson-c | |
| */ | |
| #include <json.h> | |
| #include <stdio.h> | |
| int main() { | |
| struct json_object *jobj; |
| <!-- add this snippet to your XML/Blueprint --> | |
| <!-- Oracle --> | |
| <bean id="oracleDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"> | |
| <property name="driverClassName" value="${db.driver}" /> | |
| <property name="url" value="${db.url}" /> | |
| <property name="username" value="${db.username}" /> | |
| <property name="password" value="${db.password}" /> | |
| <property name="initialSize" value="${db.pool.min}" /> | |
| <property name="maxTotal" value="${db.pool.max}" /> | |
| <property name="maxIdle" value="${db.pool.min}" /> |
| #!/bin/bash | |
| # | |
| # Highligh Nginx config file in Vim | |
| # Download syntax highlight | |
| mkdir -p ~/.vim/syntax/ | |
| wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim | |
| # Set location of Nginx config file | |
| cat > ~/.vim/filetype.vim <<EOF |
| // Get all users | |
| var url = "http://localhost:8080/api/v1/users"; | |
| var xhr = new XMLHttpRequest() | |
| xhr.open('GET', url, true) | |
| xhr.onload = function () { | |
| var users = JSON.parse(xhr.responseText); | |
| if (xhr.readyState == 4 && xhr.status == "200") { | |
| console.table(users); | |
| } else { | |
| console.error(users); |
| from("timer://scheduler?period=30s") | |
| .log("get access token") | |
| .to("direct:authService"); | |
| from("direct:authService").tracing() | |
| .setHeader(Exchange.HTTP_PATH) | |
| .simple("<auth service context>/oauth2/token") | |
| .setHeader("CamelHttpMethod") | |
| .simple("POST") | |
| .setHeader("Content-Type") |
| #include <stdio.h> | |
| #include <pthread.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define THREAD_RUN 100 | |
| typedef struct $ | |
| { | |
| char s[50]; | |
| } concurrent_update; |
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: nginx-conf | |
| data: | |
| nginx.conf: | | |
| user nginx; | |
| worker_processes 3; | |
| error_log /var/log/nginx/error.log; | |
| events { |
| #include <iostream> | |
| #include <stream_rt_handler.h> | |
| /*https://github.com/gabime/spdlog*/ | |
| #include "spdlog/spdlog.h" | |
| /***Compile by ***/ | |
| /** cd build **/ | |
| /** g++ -DSPDLOG_FMT_PRINTF -std=c++11 ../sample_with_spdlog.cpp -lsrh -pthread **/ |
| /* | |
| * Self-Explanatory Protocol Buffer Lang Guide | |
| */ | |
| /* | |
| * Why Protocol Buffers? | |
| * Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. | |
| * You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. | |
| * Protocol Buffers are Schema Of Messages. They are language agnostic. |