This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:
- Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
- Windows 10 on my PC to work.
| # Use this script to test that your Telegram bot works. | |
| # | |
| # Install the dependency | |
| # | |
| # $ gem install telegram_bot | |
| # | |
| # Run the bot | |
| # | |
| # $ ruby bot.rb | |
| # |
| /* Create a WiFi access point and provide a web server on it. */ | |
| #include <ESP8266WiFi.h> | |
| #include "./DNSServer.h" // Patched lib | |
| #include <ESP8266WebServer.h> | |
| const byte DNS_PORT = 53; // Capture DNS requests on port 53 | |
| IPAddress apIP(10, 10, 10, 1); // Private network for server | |
| DNSServer dnsServer; // Create the DNS object | |
| ESP8266WebServer webServer(80); // HTTP server |
| const http = require('http'); | |
| const server = http.createServer(); | |
| server.on('request', (request, response) => { | |
| let body = []; | |
| request.on('data', (chunk) => { | |
| body.push(chunk); | |
| }).on('end', () => { | |
| body = Buffer.concat(body).toString(); |
| (function(win){ | |
| var events = {}; | |
| function on(event, listener) { | |
| if (typeof events[event] !== 'object') { | |
| events[event] = []; | |
| } | |
| events[event].push(listener); | |
| } |
| # Pass the env-vars to MYCOMMAND | |
| eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
| # … or ... | |
| # Export the vars in .env into your shell: | |
| export $(egrep -v '^#' .env | xargs) |
This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
| package demo.taobao.com.playground.identicon; | |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.Color; | |
| import android.support.annotation.Nullable; | |
| import android.util.Log; | |
| import java.io.File; | |
| import java.io.FileOutputStream; |
| //make other links relative | |
| add_filter ('site_url', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('get_option_siteurl', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('stylesheet_directory_uri', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('template_directory_uri', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('wp_get_attachment_url', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('wp_get_attachment_thumb_url', 'wp_make_theme_links_protocols_relative'); | |
| add_filter ('the_permalink', 'wp_make_theme_links_protocols_relative'); | |
| function wp_make_theme_links_protocols_relative( $link ){ | |
| $link = str_replace("http://", "//", $link); |
CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.