io https://www.draw.io

https__www.draw.io
https://www.draw.io

io ESP8266 DS18B20 MQTT #mqtt#esp8266 #arduino

ESP8266 DS18B20 MQTT #mqtt#esp8266 #arduino

esp8266.io
/*
 Sketch which publishes temperature data from a DS1820 sensor to a MQTT topic.
 This sketch goes in deep sleep mode once the temperature has been sent to the MQTT
 topic and wakes up periodically (configure SLEEP_DELAY_IN_SECONDS accordingly).
 Hookup guide:
 - connect D0 pin to RST pin in order to enable the ESP8266 to wake up periodically
 - DS18B20:
     + connect VCC (3.3V) to the appropriate DS18B20 pin (VDD)
     + connect GND to the appopriate DS18B20 pin (GND)
     + connect D4 to the DS18B20 data pin (DQ)
     + connect a 4.7K resistor between DQ and VCC.
*/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Streaming.h>

#define SLEEP_DELAY_IN_SECONDS  30
#define ONE_WIRE_BUS            D4      // DS18B20 pin

const char* ssid = "<YOUR_WIFI_NETWORK>";
const char* password = "<YOUR_WIFI_PASSWORD>";

const char* mqtt_server = "<MQTT_BROKER_IP_ADDRESS>";
const char* mqtt_username = "<MQTT_BROKER_USERNAME>";
const char* mqtt_password = "<MQTT_BROKER_PASSWORD>";
const char* mqtt_topic = "sensors/test/temperature";

WiFiClient espClient;
PubSubClient client(espClient);

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

char temperatureString[6];

void setup() {
  // setup serial port
  Serial.begin(115200);

  // setup WiFi
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);

  // setup OneWire bus
  DS18B20.begin();
}

void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect("ESP8266Client", mqtt_username, mqtt_password)) {
      Serial.println("connected");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

float getTemperature() {
  Serial << "Requesting DS18B20 temperature..." << endl;
  float temp;
  do {
    DS18B20.requestTemperatures(); 
    temp = DS18B20.getTempCByIndex(0);
    delay(100);
  } while (temp == 85.0 || temp == (-127.0));
  return temp;
}

void loop() {
  if (!client.connected()) {
    reconnect();
  }
  client.loop();

  float temperature = getTemperature();
  // convert temperature to a string with two digits before the comma and 2 digits for precision
  dtostrf(temperature, 2, 2, temperatureString);
  // send temperature to the serial console
  Serial << "Sending temperature: " << temperatureString << endl;
  // send temperature to the MQTT topic
  client.publish(mqtt_topic, temperatureString);

  Serial << "Closing MQTT connection..." << endl;
  client.disconnect();

  Serial << "Closing WiFi connection..." << endl;
  WiFi.disconnect();

  delay(100);

  Serial << "Entering deep sleep mode for " << SLEEP_DELAY_IN_SECONDS << " seconds..." << endl;
  ESP.deepSleep(SLEEP_DELAY_IN_SECONDS * 1000000, WAKE_RF_DEFAULT);
  //ESP.deepSleep(10 * 1000, WAKE_NO_RFCAL);
  delay(500);   // wait for deep sleep to happen
}

io 以太网辅助钱包地址为https://faucet.rinkeby.io

以太网辅助钱包地址为https://faucet.rinkeby.io

secondary wallet address for faucet.rinkeby.io
0x5BfE5AfFA07fB45910bDAa0381306dC56D4efeD7

io 以太网主要钱包地址为https://faucet.rinkeby.io

以太网主要钱包地址为https://faucet.rinkeby.io

primary wallet address for faucet.rinkeby.io
0x04fD305aaB31A5e47232A637Ee59560464C0d3c7

io 由http://atom.io/packages/sync-settings自动更新

由http://atom.io/packages/sync-settings自动更新

styles.less
/*
 * Your Stylesheet
 *
 * This stylesheet is loaded when Atom starts up and is reloaded automatically
 * when it is changed and saved.
 *
 * Add your own CSS or Less to fully customize Atom.
 * If you are unfamiliar with Less, you can read more about it here:
 * http://lesscss.org
 */


/*
 * Examples
 * (To see them, uncomment and save)
 */

// style the background color of the tree view
.tree-view {
  // background-color: whitesmoke;
}

// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
  // color: white;
  // background-color: hsl(180, 24%, 12%);
}

// style UI elements inside atom-text-editor
atom-text-editor .cursor {
  // border-color: red;
}
snippets.json
# snippets.json (not found) 
snippets.cson
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
#   'Console log':
#     'prefix': 'log'
#     'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson


".text.html":
	"di":
		"prefix": "di"
		"body": '''
			<!-- begin $1 -->
			<div class="$1">
				$2
			</div>
			<!-- end $1 -->
		'''
settings.json
{
	"advanced-open-file": {
		"createFileInstantly": true
	},
	"atom-beautify": {
		"js": {
			"space_after_anon_function": true
		}
	},
	"atom-css-comb": {
		"readyMadeConfigs": "zen"
	},
	"core": {
		"disabledPackages": [
			"linter-jscs"
		],
		"telemetryConsent": "no",
		"themes": [
			"one-light-ui",
			"one-light-syntax"
		]
	},
	"editor": {
		"fontSize": 10
	},
	"exception-reporting": {
		"userId": "40f25e9c-4f9f-4c7a-b64c-39852562ce07"
	},
	"html-to-css": {
		"bem-group": true
	},
	"linter-bootlint": {
		"executablePath": "/Users/zk/.npm-global/bin/bootlint"
	},
	"linter-jscs": {},
	"linter-jshint": {
		"executablePath": "/Users/zk/.npm-global/bin/jshint"
	},
	"linter-php": {
		"executablePath": "/usr/bin/php"
	},
	"linter-sass-lint": {
		"configFile": "/Users/zk/Dropbox/!PROJECTS/raihouse-src/sass/sass-lint.yml",
		"globalNodePath": "/Users/zk/.npm-global"
	},
	"linter-stylelint": {},
	"linter-ui-default": {
		"panelHeight": 157
	},
	"pigments": {
		"groupPaletteColors": "by file",
		"markerType": "native-square-dot"
	},
	"simple-drag-drop-text": {
		"copyKey": "meta"
	},
	"sync-settings": {
		"extraFiles": [
			"preferences.json",
			"snippets.json",
			"_readme.md"
		]
	},
	"tree-view": {
		"hideIgnoredNames": true
	},
	"welcome": {
		"showOnStartup": false
	}
}
preferences.json
# preferences.json (not found) 
packages.json
[
	{
		"name": "about",
		"version": "1.7.6"
	},
	{
		"name": "advanced-open-file",
		"version": "0.16.6"
	},
	{
		"name": "archive-view",
		"version": "0.63.3"
	},
	{
		"name": "atom-beautify",
		"version": "0.30.5"
	},
	{
		"name": "atom-dark-syntax",
		"version": "0.28.0",
		"theme": "syntax"
	},
	{
		"name": "atom-dark-ui",
		"version": "0.53.0",
		"theme": "ui"
	},
	{
		"name": "atom-light-syntax",
		"version": "0.29.0",
		"theme": "syntax"
	},
	{
		"name": "atom-light-ui",
		"version": "0.46.0",
		"theme": "ui"
	},
	{
		"name": "auto-update-packages",
		"version": "1.0.1"
	},
	{
		"name": "autoclose-html",
		"version": "0.23.0"
	},
	{
		"name": "autocomplete-atom-api",
		"version": "0.10.1"
	},
	{
		"name": "autocomplete-css",
		"version": "0.16.2"
	},
	{
		"name": "autocomplete-html",
		"version": "0.8.0"
	},
	{
		"name": "autocomplete-paths",
		"version": "2.4.0"
	},
	{
		"name": "autocomplete-plus",
		"version": "2.35.5"
	},
	{
		"name": "autocomplete-snippets",
		"version": "1.11.0"
	},
	{
		"name": "autoflow",
		"version": "0.29.0"
	},
	{
		"name": "autosave",
		"version": "0.24.3"
	},
	{
		"name": "background-tips",
		"version": "0.27.1"
	},
	{
		"name": "base16-tomorrow-dark-theme",
		"version": "1.5.0",
		"theme": "syntax"
	},
	{
		"name": "base16-tomorrow-light-theme",
		"version": "1.5.0",
		"theme": "syntax"
	},
	{
		"name": "bookmarks",
		"version": "0.44.4"
	},
	{
		"name": "bracket-matcher",
		"version": "0.86.0"
	},
	{
		"name": "busy-signal",
		"version": "1.4.3"
	},
	{
		"name": "color-picker",
		"version": "2.2.5"
	},
	{
		"name": "command-palette",
		"version": "0.40.4"
	},
	{
		"name": "dalek",
		"version": "0.2.1"
	},
	{
		"name": "deprecation-cop",
		"version": "0.56.7"
	},
	{
		"name": "dev-live-reload",
		"version": "0.47.1"
	},
	{
		"name": "duplicate-line-or-selection",
		"version": "0.9.0"
	},
	{
		"name": "editorconfig",
		"version": "2.2.2"
	},
	{
		"name": "emmet",
		"version": "2.4.3"
	},
	{
		"name": "encoding-selector",
		"version": "0.23.4"
	},
	{
		"name": "exception-reporting",
		"version": "0.41.4"
	},
	{
		"name": "file-icons",
		"version": "2.1.10"
	},
	{
		"name": "find-and-replace",
		"version": "0.208.3"
	},
	{
		"name": "fuzzy-finder",
		"version": "1.5.8"
	},
	{
		"name": "git-diff",
		"version": "1.3.6"
	},
	{
		"name": "github",
		"version": "0.3.4-0"
	},
	{
		"name": "go-to-line",
		"version": "0.32.1"
	},
	{
		"name": "grammar-selector",
		"version": "0.49.5"
	},
	{
		"name": "highlight-selected",
		"version": "0.13.1"
	},
	{
		"name": "html-to-css",
		"version": "0.2.2"
	},
	{
		"name": "image-view",
		"version": "0.61.2"
	},
	{
		"name": "incompatible-packages",
		"version": "0.27.3"
	},
	{
		"name": "intentions",
		"version": "1.1.5"
	},
	{
		"name": "keybinding-resolver",
		"version": "0.38.0"
	},
	{
		"name": "language-c",
		"version": "0.58.1"
	},
	{
		"name": "language-clojure",
		"version": "0.22.3"
	},
	{
		"name": "language-coffee-script",
		"version": "0.48.7"
	},
	{
		"name": "language-csharp",
		"version": "0.14.2"
	},
	{
		"name": "language-css",
		"version": "0.42.2"
	},
	{
		"name": "language-gfm",
		"version": "0.89.1"
	},
	{
		"name": "language-git",
		"version": "0.19.1"
	},
	{
		"name": "language-go",
		"version": "0.44.1"
	},
	{
		"name": "language-html",
		"version": "0.47.3"
	},
	{
		"name": "language-hyperlink",
		"version": "0.16.1"
	},
	{
		"name": "language-java",
		"version": "0.27.2"
	},
	{
		"name": "language-javascript",
		"version": "0.126.1"
	},
	{
		"name": "language-json",
		"version": "0.19.1"
	},
	{
		"name": "language-less",
		"version": "0.32.0"
	},
	{
		"name": "language-make",
		"version": "0.22.3"
	},
	{
		"name": "language-mustache",
		"version": "0.14.1"
	},
	{
		"name": "language-objective-c",
		"version": "0.15.1"
	},
	{
		"name": "language-perl",
		"version": "0.37.0"
	},
	{
		"name": "language-php",
		"version": "0.39.0"
	},
	{
		"name": "language-property-list",
		"version": "0.9.1"
	},
	{
		"name": "language-pug",
		"version": "0.0.21"
	},
	{
		"name": "language-python",
		"version": "0.45.3"
	},
	{
		"name": "language-ruby",
		"version": "0.71.1"
	},
	{
		"name": "language-ruby-on-rails",
		"version": "0.25.2"
	},
	{
		"name": "language-sass",
		"version": "0.59.0"
	},
	{
		"name": "language-shellscript",
		"version": "0.25.1"
	},
	{
		"name": "language-source",
		"version": "0.9.0"
	},
	{
		"name": "language-sql",
		"version": "0.25.6"
	},
	{
		"name": "language-text",
		"version": "0.7.3"
	},
	{
		"name": "language-todo",
		"version": "0.29.1"
	},
	{
		"name": "language-toml",
		"version": "0.18.1"
	},
	{
		"name": "language-xml",
		"version": "0.35.1"
	},
	{
		"name": "language-yaml",
		"version": "0.30.0"
	},
	{
		"name": "line-ending-selector",
		"version": "0.7.3"
	},
	{
		"name": "link",
		"version": "0.31.3"
	},
	{
		"name": "linter",
		"version": "2.2.0"
	},
	{
		"name": "linter-bootlint",
		"version": "1.0.4"
	},
	{
		"name": "linter-csslint",
		"version": "1.3.4"
	},
	{
		"name": "linter-jscs",
		"version": "4.1.2"
	},
	{
		"name": "linter-jshint",
		"version": "3.1.5"
	},
	{
		"name": "linter-jsonlint",
		"version": "1.3.0"
	},
	{
		"name": "linter-php",
		"version": "1.3.2"
	},
	{
		"name": "linter-sass-lint",
		"version": "1.7.4"
	},
	{
		"name": "linter-stylelint",
		"version": "4.0.1"
	},
	{
		"name": "linter-ui-default",
		"version": "1.6.4"
	},
	{
		"name": "markdown-preview",
		"version": "0.159.12"
	},
	{
		"name": "metrics",
		"version": "1.2.6"
	},
	{
		"name": "notifications",
		"version": "0.67.2"
	},
	{
		"name": "one-dark-syntax",
		"version": "1.7.1",
		"theme": "syntax"
	},
	{
		"name": "one-dark-ui",
		"version": "1.10.5",
		"theme": "ui"
	},
	{
		"name": "one-light-syntax",
		"version": "1.7.1",
		"theme": "syntax"
	},
	{
		"name": "one-light-ui",
		"version": "1.10.5",
		"theme": "ui"
	},
	{
		"name": "open-on-github",
		"version": "1.2.1"
	},
	{
		"name": "package-generator",
		"version": "1.1.1"
	},
	{
		"name": "pigments",
		"version": "0.40.2"
	},
	{
		"name": "project-manager",
		"version": "3.3.5"
	},
	{
		"name": "settings-view",
		"version": "0.250.0"
	},
	{
		"name": "snippets",
		"version": "1.1.4"
	},
	{
		"name": "solarized-dark-syntax",
		"version": "1.1.2",
		"theme": "syntax"
	},
	{
		"name": "solarized-light-syntax",
		"version": "1.1.2",
		"theme": "syntax"
	},
	{
		"name": "spell-check",
		"version": "0.71.4"
	},
	{
		"name": "status-bar",
		"version": "1.8.11"
	},
	{
		"name": "styleguide",
		"version": "0.49.6"
	},
	{
		"name": "symbols-view",
		"version": "0.116.1"
	},
	{
		"name": "sync-settings",
		"version": "0.8.2"
	},
	{
		"name": "tabs",
		"version": "0.106.2"
	},
	{
		"name": "timecop",
		"version": "0.36.0"
	},
	{
		"name": "tree-view",
		"version": "0.217.2"
	},
	{
		"name": "update-package-dependencies",
		"version": "0.12.0"
	},
	{
		"name": "welcome",
		"version": "0.36.4"
	},
	{
		"name": "whitespace",
		"version": "0.37.2"
	},
	{
		"name": "wrap-guide",
		"version": "0.40.2"
	}
]
keymap.cson
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
#   'enter': 'editor:newline'
#
# 'atom-workspace':
#   'ctrl-shift-p': 'core:move-up'
#   'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * http://flight-manual.atom.io/using-atom/sections/basic-customization/#_customizing_keybindings
# * http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * http://flight-manual.atom.io/hacking-atom/sections/debugging/#check-the-keybindings
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson

'atom-workspace':
  'cmd-shift-up': 'editor:move-line-up'
  'cmd-shift-down': 'editor:move-line-down'

'atom-text-editor[data-grammar="source js jsx"]:not([mini])':
  'tab': 'emmet:expand-abbreviation-with-tab'

'atom-workspace atom-pane':
  'ctrl-alt--': 'user:insert-em-dash'

'.platform-win32 atom-text-editor':
  'ctrl-alt-.': 'user:insert-elquo'
  'alt-w': 'emmet:wrap-with-abbreviation'
  'ctrl-shift-m': 'markdown-preview:toggle' # ХЗ отчего это не работает сразу...

'.platform-darwin atom-text-editor:not([mini])':
  "shift-cmd-'": 'emmet:update-tag'
  "shift-cmd-;": 'emmet:remove-tag'
  'alt-w': 'emmet:wrap-with-abbreviation'
init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
#   editor.onDidSave ->
#     console.log "Saved! #{editor.getPath()}"
_readme.md
# _readme.md (not found) 
_atom.io
Настройки Atom. Синхронизация между несколькими устройствами.

Смотри плагин sync-settings, чтобы забрать себе все эти настройки. Или можно скачать эти файлы и заменить у себя в ~/.atom/

io 用于phusion乘客开源的示例nginx配置文件

用于phusion乘客开源的示例nginx配置文件

magicbell.io
server {
  listen 443;
  root /home/rails/apps/magicbell_site/current/public;
  server_name magicbell.io;

  # Use certificates we purchased from https://www.ssl2buy.com
  ssl on;
  ssl_certificate /etc/nginx/certs/magicbell.io/magicbell.io.crt;
  ssl_certificate_key /etc/nginx/certs/magicbell.io/magicbell.io.key;

  passenger_enabled on;
  passenger_sticky_sessions on;
  passenger_ruby /usr/local/rvm/wrappers/ruby-2.4.1/ruby;
  index index.htm index.html;
}

io keybase.io

keybase.io
### Keybase proof

I hereby claim:

  * I am kotp on github.
  * I am kotp (https://keybase.io/kotp) on keybase.
  * I have a public key ASAZ-2QjHxmrp0drjwUoaSzV7bXnawAQN94aXJuRAbsQpgo

To claim this, I am signing this object:

```json
{
    "body": {
        "key": {
            "eldest_kid": "012019fb64231f19aba7476b8f0528692cd5edb5e76b001037de1a5c9b9101bb10a60a",
            "host": "keybase.io",
            "kid": "012019fb64231f19aba7476b8f0528692cd5edb5e76b001037de1a5c9b9101bb10a60a",
            "uid": "5b7c67faedafe6d7b4085f3d372b9d00",
            "username": "kotp"
        },
        "service": {
            "name": "github",
            "username": "kotp"
        },
        "type": "web_service_binding",
        "version": 1
    },
    "client": {
        "name": "keybase.io go client",
        "version": "1.0.18"
    },
    "ctime": 1487185827,
    "expire_in": 504576000,
    "merkle_root": {
        "ctime": 1487185808,
        "hash": "daa6e21ac718801557b0ad29bb8151ba1d3bd0153bab58ad20d75fe5064f45575029e42893cf2f1778f0208b55eca4110926ed062baf7e340b50cd2efea88224",
        "seqno": 893390
    },
    "prev": "3713244c275878cbd043e26183e854a6488fae268cbbe670025e09efaddff5a5",
    "seqno": 18,
    "tag": "signature"
}
```

with the key [ASAZ-2QjHxmrp0drjwUoaSzV7bXnawAQN94aXJuRAbsQpgo](https://keybase.io/kotp), yielding the signature:

```
hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgGftkIx8Zq6dHa48FKGks1e2152sAEDfeGlybkQG7EKYKp3BheWxvYWTFAuV7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwMTlmYjY0MjMxZjE5YWJhNzQ3NmI4ZjA1Mjg2OTJjZDVlZGI1ZTc2YjAwMTAzN2RlMWE1YzliOTEwMWJiMTBhNjBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwMTlmYjY0MjMxZjE5YWJhNzQ3NmI4ZjA1Mjg2OTJjZDVlZGI1ZTc2YjAwMTAzN2RlMWE1YzliOTEwMWJiMTBhNjBhIiwidWlkIjoiNWI3YzY3ZmFlZGFmZTZkN2I0MDg1ZjNkMzcyYjlkMDAiLCJ1c2VybmFtZSI6ImtvdHAifSwic2VydmljZSI6eyJuYW1lIjoiZ2l0aHViIiwidXNlcm5hbWUiOiJrb3RwIn0sInR5cGUiOiJ3ZWJfc2VydmljZV9iaW5kaW5nIiwidmVyc2lvbiI6MX0sImNsaWVudCI6eyJuYW1lIjoia2V5YmFzZS5pbyBnbyBjbGllbnQiLCJ2ZXJzaW9uIjoiMS4wLjE4In0sImN0aW1lIjoxNDg3MTg1ODI3LCJleHBpcmVfaW4iOjUwNDU3NjAwMCwibWVya2xlX3Jvb3QiOnsiY3RpbWUiOjE0ODcxODU4MDgsImhhc2giOiJkYWE2ZTIxYWM3MTg4MDE1NTdiMGFkMjliYjgxNTFiYTFkM2JkMDE1M2JhYjU4YWQyMGQ3NWZlNTA2NGY0NTU3NTAyOWU0Mjg5M2NmMmYxNzc4ZjAyMDhiNTVlY2E0MTEwOTI2ZWQwNjJiYWY3ZTM0MGI1MGNkMmVmZWE4ODIyNCIsInNlcW5vIjo4OTMzOTB9LCJwcmV2IjoiMzcxMzI0NGMyNzU4NzhjYmQwNDNlMjYxODNlODU0YTY0ODhmYWUyNjhjYmJlNjcwMDI1ZTA5ZWZhZGRmZjVhNSIsInNlcW5vIjoxOCwidGFnIjoic2lnbmF0dXJlIn2jc2lnxEDGeOgSktBTVmnU/55YjgvoxIZVrGZwzRW2UWF+XtGRzYG1wYE7I3jXTGnEH3zCDSJN1NaCySW46blw5X/tYrgAqHNpZ190eXBlIKRoYXNogqR0eXBlCKV2YWx1ZcQg+1BCFHsQRkdoHodTin/EdzXO46t2BS2AVNXZ1ZeKanKjdGFnzQICp3ZlcnNpb24B

```

And finally, I am proving ownership of the github account by posting this as a gist.

### My publicly-auditable identity:

https://keybase.io/kotp

### From the command line:

Consider the [keybase command line program](https://keybase.io/download).

```bash
# look me up
keybase id kotp
```

io Io语言网站上缺少示例问题,所以这里是备份。

Io语言网站上缺少示例问题,所以这里是备份。

sample.io
# Hello world

"Hello world!" print

# Factorial

factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer

bottle := method(i,
     if(i == 0, return "no more bottles")
     if(i == 1, return "1 bottle")
     return "" .. i .. " bottles"
)

for(i, 99, 1,
     writeln(current, " of beer on the wall, ", current, " of beer,\n",
          "take one down, pass it around,\n",
          bottle(i - 1), " of beer on the wall.\n")
)

# Create a simple object and show how to use it

Account := Object clone
Account balance := 0
Account deposit  := method(v, balance = balance + v)
Account withdraw := method(v, balance = balance - v)
Account show := method(
  writeln("Account balance: $", balance)
)

myAccount := Account clone
myAccount show
"Depositing $10\n" print
myAccount deposit(10)
myAccount show

# Concurrency example - the following will print "112233"

o1 := Object clone
o1 test := method(for(n, 1, 3, n print; yield))
o2 := o1 clone

// @ means send an asynchronous message
o1 @test; o2 @test 

// wait for the messages to get processed
while(Scheduler activeActorCount > 1, yield) 

# Look up a class/prototype given its name as a string

Lobby getSlot("PrototypeName")

# Execute a method given its name as a string

anObject perform("SomeMethodName", arg1, arg2)

# Find out if a method with a given name (again a string) exists

anObject hasSlot("SomeMethodName")

# Given an arbitrary reference to a class/prototype, instantiate it

newInstance := objectRef clone

# Add a method to a primitive

Number double := method(self * 2)
1 double
==> 2

# Subclass a primitive

MyList := List clone // Same as creating an instance

# Iterate through an inheritance hierarchy

Object printAllSlots := method(  
  self slotNames foreach(i, slotName, 
    writeln(slotName)
    if(self hasSlot("proto"), self proto printAllSlots
  )
)
Object printAllSlots

# Implement a generic proxy

Proxy = Object clone
Proxy forward := method(
  methodName := thisMessage name
  args := thisMessage argsEvaluatedIn(sender)

  // When an unrecognized message is received,
  // this method will be invoked.
  // Do what you like with the message here -
  // such as send it over a network, etc.
)

# Implement a singleton

Foo := Object clone
Foo clone := Foo

# Print the source code of a method

myMethod := method(return testing(1+2+3))
getSlot("myMethod") code print
==> "return(testing(1+(2)+(3)))"

# Add an operator method to an object

MyObject := Object clone
MyObject setSlot("+",  method(n, write("adding ", n, "\n")))
MyObject + 123
==> "adding 123"

# Mixins and Aspects

a := Object clone

Mix := Object clone
Mix logData := Buffer clone
Mix init := method(logData = logData clone)
Mix log := method(s, logData append(s))

a parent := Mix clone // Now a also inherits the state and behavior of Mix

b := Object clone
b parent := Mix clone // Now multiple objects use it so it's an "aspect"

# An auto source file importer

Object searchPaths = List clone add(launchPath)

Object forward := method(
  methodName := thisMessage name
  if (methodName characterAt(0) isUpperCase,
    searchPaths foreach(i, searchPath,
      fileName := searchPath appendPath(methodName .. ".io")
      sourceFile := File clone setPath(fileName)
      if (sourceFile exists) then (
        Lobby doFile(path)
        return Lobby getSlot(methodName)
      )
    )
  )
  raiseException("Importer", "Could not find slot for " .. methodName)
)

# A simple whois client

whois := method(host,
  socket := Socket clone setHostName("rs.internic.net") setPort(43) 
  socket connect write(host, "\n")
  while(socket readNextChunk, nil) // socket read auto yields to other coroutines
  return socket readBuffer
)

# An echo server

Echo := Object clone
Echo handleSocket := method(socket,
  while(socket isOpen, 
    if(socket read, socket write(socket readBuffer))
    socket readBuffer empty
  )
)

EchoServer := Server clone setPort(8456) 
EchoServer handleSocket := method(socket,
  Echo clone @handleSocket(socket) 
  // async message so it's handled in separate coroutine
)
EchoServer start

io Rijksmuseum API

Rijksmuseum API

rijksmuseum.github.io
The live website API (which has a live link to the website platform) makes the full power of the award-winning Rijksmuseum website directly accessible to a large group of developers. Searching the collection is one activity that offers a wide range of interesting options. The same is true of the “explore the collection” pages, the Rijksstudio users’ collections, and the tiled images used to zoom in to tight close-ups of works of art. Calendar information is also available, for example. The JSON-based service is so simple that, in no time at all, you can build something that makes use of the Rijksmuseum’s rich and attractive content.


The Rijksmuseum API (Application Programming Interface) is a new, state-of-the-art service for application developers. The Rijksmuseum offers the API to make its collection (as well as other content and high resolution images) available for use in apps or web applications, for example.




http://rijksmuseum.github.io/

io ionic.io

ionic.io

setup for ionic.io
ionic add ionic-service-core

ionic io init