<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Ourdark]]></title><description><![CDATA[To be providing you always have another option]]></description><link>https://blog.ourdark.org/</link><image><url>https://blog.ourdark.org/favicon.png</url><title>Ourdark</title><link>https://blog.ourdark.org/</link></image><generator>Ghost 4.39</generator><lastBuildDate>Wed, 08 Apr 2026 11:57:38 GMT</lastBuildDate><atom:link href="https://blog.ourdark.org/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Epel repo]]></title><description><![CDATA[<p>/etc/yum.repo.d/<a href="epel.repo">epel.repo</a></p><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>echo -E &apos;[epel]&apos; &gt; /etc/yum.repos.d/epel.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - $basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/7/</code></pre>]]></description><link>https://blog.ourdark.org/epel-repo/</link><guid isPermaLink="false">67f4ff35563af400011aa5f2</guid><category><![CDATA[Basic]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 08 Apr 2025 10:54:51 GMT</pubDate><content:encoded><![CDATA[<p>/etc/yum.repo.d/<a href="epel.repo">epel.repo</a></p><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>echo -E &apos;[epel]&apos; &gt; /etc/yum.repos.d/epel.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - $basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;enabled=1&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;[epel-debuginfo]&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - $basearch - Debug&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;enabled=0&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;[epel-source]&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - $basearch - Source&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;enabled=0&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel.repo
</code></pre><!--kg-card-end: markdown--><p>/etc/yum.repo.d/<a href="epel-testing.repo">epel-testing.repo</a></p><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>echo -E &apos;[epel-testing]&apos; &gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - Testing - $basearch&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;enabled=0&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;[epel-testing-debuginfo]&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch/debug&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;enabled=0&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;[epel-testing-source]&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/SRPMS&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&amp;arch=$basearch&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;failovermethod=priority&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;enabled=0&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
echo -E &apos;gpgcheck=1&apos; &gt;&gt; /etc/yum.repos.d/epel-testing.repo
</code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install OpenVPN on ec2]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>yum update -y
amazon-linux-extras install epel  
yum install -y epel-release 
yum install firewalld wget -y
yum install -y openvpn easy-rsa
#config
mkdir /etc/openvpn/easy-rsa
cp -r /usr/share/easy-rsa/3.0.8/* /etc/openvpn/easy-rsa/
#var
openvpn --genkey --secret /etc/openvpn/myvpn.tlsauth
cd easy-rsa/
./easyrsa clean-all
./easyrsa build-ca</code></pre>]]></description><link>https://blog.ourdark.org/install-openvpn-on-ec2/</link><guid isPermaLink="false">62301eab64b2890001dc40a3</guid><category><![CDATA[Basic]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Fri, 14 Feb 2025 07:57:06 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>yum update -y
amazon-linux-extras install epel  
yum install -y epel-release 
yum install firewalld wget -y
yum install -y openvpn easy-rsa
#config
mkdir /etc/openvpn/easy-rsa
cp -r /usr/share/easy-rsa/3.0.8/* /etc/openvpn/easy-rsa/
#var
openvpn --genkey --secret /etc/openvpn/myvpn.tlsauth
cd easy-rsa/
./easyrsa clean-all
./easyrsa build-ca nopass
./easyrsa build-server-full server nopass
./easyrsa gen-dh
;./easyrsa build-client-full aws nopass
./easyrsa gen-crl
cp -t /etc/openvpn/ \
/etc/openvpn/easy-rsa/pki/ca.crt \
/etc/openvpn/easy-rsa/pki/dh.pem \
/etc/openvpn/easy-rsa/pki/issued/server.crt \
/etc/openvpn/easy-rsa/pki/private/ca.key \
/etc/openvpn/easy-rsa/pki/private/server.key 
systemctl -f enable openvpn-server@server 
systemctl -f start openvpn-server@server 
systemctl -f status openvpn-server@server

systemctl enable firewalld
systemctl start firewalld
systemctl status firewalld

firewall-cmd --zone=public --add-interface=tun0 --permanent
firewall-cmd --zone=public --add-port=6174/tcp --permanent

firewall-cmd --get-active-zones
sudo firewall-cmd --zone=public --add-service openvpn --permanent
sudo firewall-cmd --list-services --zone=public
sudo firewall-cmd --add-masquerade --permanent

sudo firewall-cmd --reload
sudo firewall-cmd --query-masquerade

VAR=$(ip route get 208.67.222.222 | awk &apos;NR==1 {print $4}&apos;)
sudo firewall-cmd --permanent --direct --passthrough ipv4 -t nat -A POSTROUTING -s 10.8.0.0/24 -o $VAR -j MASQUERADE
sudo firewall-cmd --reload

sudo vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
/usr/local/bin/gen-ovpn-client
</code></pre><!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org"><code>#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients <-> one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine <-> single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# &quot;C:\\Program Files\\OpenVPN\\config\\foo.key&quot; #
#                                               #
# Comments are preceded with &apos;#&apos; or &apos;;&apos;         #
#################################################
# openvpn --config /path/to/server.conf
# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 6174

# TCP or UDP server?
proto tcp4
;proto udp

# &quot;dev tun&quot; will create a routed IP tunnel,
# &quot;dev tap&quot; will create an ethernet tunnel.
# Use &quot;dev tap0&quot; if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use &quot;dev-node&quot; for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don&apos;t need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the &quot;easy-rsa&quot; directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see &quot;pkcs12&quot; directive in man page).
;ca /etc/openvpn/ca.crt
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh2048.pem 2048
dh /etc/openvpn/dh.pem

# Network topology
# Should be subnet (addressing via IP)
# unless Windows clients v2.0.9 and lower have to
# be supported (then net30, i.e. a /30 per client)
# Defaults to net30 (not recommended)
topology subnet

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.8.0.0 255.255.255.0

# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
;ifconfig-pool-persist ipp.txt

# Configure server mode for ethernet bridging.
# You must first use your OS&apos;s bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS&apos;s bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;push &quot;route 192.168.10.0 255.255.255.0&quot;
;push &quot;route 192.168.20.0 255.255.255.0&quot;

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory &quot;ccd&quot; for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name &quot;Thelonious&quot;
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious&apos; private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using &quot;dev tun&quot; and &quot;server&quot; directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
push &quot;redirect-gateway def1 bypass-dhcp&quot;

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
push &quot;dhcp-option DNS 208.67.222.222&quot;
push &quot;dhcp-option DNS 208.67.220.220&quot;

# Uncomment this directive to allow different
# clients to be able to &quot;see&quot; each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server&apos;s TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE &quot;COMMON NAME&quot;,
# UNCOMMENT THIS LINE OUT.
duplicate-cn

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# For extra security beyond that provided
# by SSL/TLS, create an &quot;HMAC firewall&quot;
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey tls-auth ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be &apos;0&apos;
# on the server and &apos;1&apos; on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
# Note that v2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC

# Enable compression on the VPN link and push the
# option to the client (v2.4+ only, for earlier
# versions see below)
;compress lz4-v2
;push &quot;compress lz4-v2&quot;

# For compression compatible with older clients use comp-lzo
# If you enable it here, you must also
# enable it in the client config file.
;comp-lzo
;allow-compression yes

# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100

# It&apos;s a good idea to reduce the OpenVPN
# daemon&apos;s privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user nobody
group nobody

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the &quot;\Program Files\OpenVPN\log&quot; directory).
# Use log or log-append to override this default.
# &quot;log&quot; will truncate the log file on OpenVPN startup,
# while &quot;log-append&quot; will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
log-append  /var/log/openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 5

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20

# Notify the client that when the server restarts so it
# can automatically reconnect.
# explicit-exit-notify 1

tls-crypt /etc/openvpn/myvpn.tlsauth

crl-verify /etc/openvpn/easy-rsa/pki/crl.pem
</-></-></-></code></pre><!--kg-card-end: markdown--><p>/easyrsa/vars</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org"><code># Easy-RSA 3 parameter settings

# NOTE: If you installed Easy-RSA from your distro&apos;s package manager, don&apos;t edit
# this file in place -- instead, you should copy the entire easy-rsa directory
# to another location so future upgrades don&apos;t wipe out your changes.

# HOW TO USE THIS FILE
#
# vars.example contains built-in examples to Easy-RSA settings. You MUST name
# this file &apos;vars&apos; if you want it to be used as a configuration file. If you do
# not, it WILL NOT be automatically read when you call easyrsa commands.
#
# It is not necessary to use this config file unless you wish to change
# operational defaults. These defaults should be fine for many uses without the
# need to copy and edit the &apos;vars&apos; file.
#
# All of the editable settings are shown commented and start with the command
# &apos;set_var&apos; -- this means any set_var command that is uncommented has been
# modified by the user. If you&apos;re happy with a default, there is no need to
# define the value to its default.

# NOTES FOR WINDOWS USERS
#
# Paths for Windows  *MUST* use forward slashes, or optionally double-escaped
# backslashes (single forward slashes are recommended.) This means your path to
# the openssl binary might look like this:
# &quot;C:/Program Files/OpenSSL-Win32/bin/openssl.exe&quot;

# A little housekeeping: DON&apos;T EDIT THIS SECTION
# 
# Easy-RSA 3.x doesn&apos;t source into the environment directly.
# Complain if a user tries to do this:
if [ -z &quot;$EASYRSA_CALLER&quot; ]; then
        echo &quot;You appear to be sourcing an Easy-RSA &apos;vars&apos; file.&quot; &gt;&amp;2
        echo &quot;This is no longer necessary and is disallowed. See the section called&quot; &gt;&amp;2
        echo &quot;&apos;How to use this file&apos; near the top comments for more details.&quot; &gt;&amp;2
        return 1
fi

# DO YOUR EDITS BELOW THIS POINT

# This variable is used as the base location of configuration files needed by
# easyrsa.  More specific variables for specific files (e.g., EASYRSA_SSL_CONF)
# may override this default.
#
# The default value of this variable is the location of the easyrsa script
# itself, which is also where the configuration files are located in the
# easy-rsa tree.

#set_var EASYRSA        &quot;${0%/*}&quot;

# If your OpenSSL command is not in the system PATH, you will need to define the
# path to it here. Normally this means a full path to the executable, otherwise
# you could have left it undefined here and the shown default would be used.
#
# Windows users, remember to use paths with forward-slashes (or escaped
# back-slashes.) Windows users should declare the full path to the openssl
# binary here if it is not in their system PATH.

#set_var EASYRSA_OPENSSL        &quot;openssl&quot;
#
# This sample is in Windows syntax -- edit it for your path if not using PATH:
#set_var EASYRSA_OPENSSL        &quot;C:/Program Files/OpenSSL-Win32/bin/openssl.exe&quot;

# Edit this variable to point to your soon-to-be-created key directory.  By
# default, this will be &quot;$PWD/pki&quot; (i.e. the &quot;pki&quot; subdirectory of the
# directory you are currently in).
#
# WARNING: init-pki will do a rm -rf on this directory so make sure you define
# it correctly! (Interactive mode will prompt before acting.)

#set_var EASYRSA_PKI            &quot;$PWD/pki&quot;

# Define directory for temporary subdirectories.

#set_var EASYRSA_TEMP_DIR       &quot;$EASYRSA_PKI&quot;

# Define X509 DN mode.
# This is used to adjust what elements are included in the Subject field as the DN
# (this is the &quot;Distinguished Name.&quot;)
# Note that in cn_only mode the Organizational fields further below aren&apos;t used.
#
# Choices are:
#   cn_only  - use just a CN value
#   org      - use the &quot;traditional&quot; Country/Province/City/Org/OU/email/CN format

#set_var EASYRSA_DN     &quot;cn_only&quot;

# Organizational fields (used with &apos;org&apos; mode and ignored in &apos;cn_only&apos; mode.)
# These are the default values for fields which will be placed in the
# certificate.  Don&apos;t leave any of these fields blank, although interactively
# you may omit any specific field by typing the &quot;.&quot; symbol (not valid for
# email.)

#set_var EASYRSA_REQ_COUNTRY    &quot;US&quot;
#set_var EASYRSA_REQ_PROVINCE   &quot;California&quot;
#set_var EASYRSA_REQ_CITY       &quot;San Francisco&quot;
#set_var EASYRSA_REQ_ORG        &quot;Copyleft Certificate Co&quot;
#set_var EASYRSA_REQ_EMAIL      &quot;me@example.net&quot;
#set_var EASYRSA_REQ_OU         &quot;My Organizational Unit&quot;

# Choose a size in bits for your keypairs. The recommended value is 2048.  Using
# 2048-bit keys is considered more than sufficient for many years into the
# future. Larger keysizes will slow down TLS negotiation and make key/DH param
# generation take much longer. Values up to 4096 should be accepted by most
# software. Only used when the crypto alg is rsa (see below.)

#set_var EASYRSA_KEY_SIZE       2048

# The default crypto mode is rsa; ec can enable elliptic curve support.
# Note that not all software supports ECC, so use care when enabling it.
# Choices for crypto alg are: (each in lower-case)
#  * rsa
#  * ec
#  * ed

#set_var EASYRSA_ALGO           rsa

# Define the named curve, used in ec &amp; ed modes:

#set_var EASYRSA_CURVE          secp384r1

# In how many days should the root CA key expire?

set_var EASYRSA_CA_EXPIRE      3650

# In how many days should certificates expire?

set_var EASYRSA_CERT_EXPIRE    825

# How many days until the next CRL publish date?  Note that the CRL can still be
# parsed after this timeframe passes. It is only used for an expected next
# publication date.
#set_var EASYRSA_CRL_DAYS       180

# How many days before its expiration date a certificate is allowed to be
# renewed?
#set_var EASYRSA_CERT_RENEW     30

# Random serial numbers by default, set to no for the old incremental serial numbers
#
#set_var EASYRSA_RAND_SN        &quot;yes&quot;

# Support deprecated &quot;Netscape&quot; extensions? (choices &quot;yes&quot; or &quot;no&quot;.) The default
# is &quot;no&quot; to discourage use of deprecated extensions. If you require this
# feature to use with --ns-cert-type, set this to &quot;yes&quot; here. This support
# should be replaced with the more modern --remote-cert-tls feature.  If you do
# not use --ns-cert-type in your configs, it is safe (and recommended) to leave
# this defined to &quot;no&quot;.  When set to &quot;yes&quot;, server-signed certs get the
# nsCertType=server attribute, and also get any NS_COMMENT defined below in the
# nsComment field.

#set_var EASYRSA_NS_SUPPORT     &quot;no&quot;

# When NS_SUPPORT is set to &quot;yes&quot;, this field is added as the nsComment field.
# Set this blank to omit it. With NS_SUPPORT set to &quot;no&quot; this field is ignored.

#set_var EASYRSA_NS_COMMENT     &quot;Easy-RSA Generated Certificate&quot;

# A temp file used to stage cert extensions during signing. The default should
# be fine for most users; however, some users might want an alternative under a
# RAM-based FS, such as /dev/shm or /tmp on some systems.

#set_var EASYRSA_TEMP_FILE      &quot;$EASYRSA_PKI/extensions.temp&quot;

# !!
# NOTE: ADVANCED OPTIONS BELOW THIS POINT
# PLAY WITH THEM AT YOUR OWN RISK
# !!

# Broken shell command aliases: If you have a largely broken shell that is
# missing any of these POSIX-required commands used by Easy-RSA, you will need
# to define an alias to the proper path for the command.  The symptom will be
# some form of a &apos;command not found&apos; error from your shell. This means your
# shell is BROKEN, but you can hack around it here if you really need. These
# shown values are not defaults: it is up to you to know what you&apos;re doing if
# you touch these.
#
#alias awk=&quot;/alt/bin/awk&quot;
#alias cat=&quot;/alt/bin/cat&quot;

# X509 extensions directory:
# If you want to customize the X509 extensions used, set the directory to look
# for extensions here. Each cert type you sign must have a matching filename,
# and an optional file named &apos;COMMON&apos; is included first when present. Note that
# when undefined here, default behaviour is to look in $EASYRSA_PKI first, then
# fallback to $EASYRSA for the &apos;x509-types&apos; dir.  You may override this
# detection with an explicit dir here.
#
#set_var EASYRSA_EXT_DIR        &quot;$EASYRSA/x509-types&quot;

# If you want to generate KDC certificates, you need to set the realm here.
#set_var EASYRSA_KDC_REALM      &quot;CHANGEME.EXAMPLE.COM&quot;

# OpenSSL config file:
# If you need to use a specific openssl config file, you can reference it here.
# Normally this file is auto-detected from a file named openssl-easyrsa.cnf from the
# EASYRSA_PKI or EASYRSA dir (in that order.) NOTE that this file is Easy-RSA
# specific and you cannot just use a standard config file, so this is an
# advanced feature.

#set_var EASYRSA_SSL_CONF       &quot;$EASYRSA/openssl-easyrsa.cnf&quot;

# Default CN:
# This is best left alone. Interactively you will set this manually, and BATCH
# callers are expected to set this themselves.

#set_var EASYRSA_REQ_CN         &quot;ChangeMe&quot;

# Cryptographic digest to use.
# Do not change this default unless you understand the security implications.
# Valid choices include: md5, sha1, sha256, sha224, sha384, sha512

#set_var EASYRSA_DIGEST         &quot;sha256&quot;

# Batch mode. Leave this disabled unless you intend to call Easy-RSA explicitly
# in batch mode without any user input, confirmation on dangerous operations,
# or most output. Setting this to any non-blank string enables batch mode.

#set_var EASYRSA_BATCH          &quot;&quot;
set_var EASYRSA_REQ_COUNTRY    &quot;Japan&quot;
set_var EASYRSA_REQ_PROVINCE   &quot;Osaka&quot;
set_var EASYRSA_REQ_CITY       &quot;Osaka&quot;
set_var EASYRSA_REQ_ORG        &quot;Ourdark&quot;
set_var EASYRSA_REQ_EMAIL      &quot;ourdark@ourdark.org&quot;
set_var EASYRSA_REQ_OU         &quot;Ourdark inc.&quot;
</code></pre><!--kg-card-end: markdown--><p>/usr/local/bin/gen-ovpn-client</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org"><code>#!/bin/sh

#*****MUST CHANGE***REPLACE WITH YOUR PUBLIC IP*****
PUBLICIP=&quot;ourdark.org&quot;

#SERVERPORT: OpenVPN Port on this server. Standard OpenVPN port is 1194.
SERVERPORT=&quot;6174&quot;

#LOCALPORT: Client&apos;s outgoing port. Standard is 1194. If changed, alert 
#clients to adjust their
#firewalls accordingly.
LOCALPORT=&quot;6174&quot;

echo &quot;Client Name: &quot;
read clientname

#EasyRSA Directory; update path if needed
cd /etc/openvpn/easy-rsa/

/etc/openvpn/easy-rsa/easyrsa build-client-full $clientname

#Generating client in /etc/openvpn/client/
profilename=&quot;$clientname.ovpn&quot;
touch /etc/openvpn/client/$profilename

printf &quot;client\nverb 4\nconnect-retry 2 300\nresolv-retry 60\ndev tun\nremote $PUBLICIP $SERVERPORT tcp\n--float\nlport $LOCALPORT\nproto tcp\n<ca>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#ca.crt; update path if needed
cat /etc/openvpn/ca.crt &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</ca>\n<key>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#client private key; update path if needed
cat /etc/openvpn/easy-rsa/pki/private/$clientname* &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</key>\n<cert>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#client certificate; update path if needed
cat /etc/openvpn/easy-rsa/pki/issued/$clientname* &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</cert>\n<tls-crypt>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#static TLS auth key; update path if needed
cat /etc/openvpn/myvpn.tlsauth &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</tls-crypt>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

echo &quot;The client profile is located at /etc/openvpn/client/$profilename&quot;
</code></pre><!--kg-card-end: markdown--><p>/usr/local/bin/gen-ovpn-client-ios</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org"><code>#!/bin/sh

#*****MUST CHANGE***REPLACE WITH YOUR PUBLIC IP*****
PUBLICIP=&quot;ourdark.org&quot;

#SERVERPORT: OpenVPN Port on this server. Standard OpenVPN port is 1194.
SERVERPORT=&quot;6174&quot;

#LOCALPORT: Client&apos;s outgoing port. Standard is 1194. If changed, alert 
#clients to adjust their
#firewalls accordingly.
LOCALPORT=&quot;6174&quot;

echo &quot;Client Name: &quot;
read clientname

#EasyRSA Directory; update path if needed
cd /etc/openvpn/easy-rsa/

/etc/openvpn/easy-rsa/easyrsa build-client-full $clientname

#Generating client in /etc/openvpn/client/
profilename=&quot;$clientname.ovpn&quot;
touch /etc/openvpn/client/$profilename

printf &quot;client\nverb 4\ndev tun\nremote $PUBLICIP $SERVERPORT tcp\nproto tcp\n<ca>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#ca.crt; update path if needed
cat /etc/openvpn/ca.crt &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</ca>\n<key>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#client private key; update path if needed
cat /etc/openvpn/easy-rsa/pki/private/$clientname* &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</key>\n<cert>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#client certificate; update path if needed
cat /etc/openvpn/easy-rsa/pki/issued/$clientname* &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</cert>\n<tls-crypt>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

#static TLS auth key; update path if needed
cat /etc/openvpn/myvpn.tlsauth &gt;&gt; /etc/openvpn/client/$profilename

printf &quot;</tls-crypt>\n&quot; &gt;&gt; /etc/openvpn/client/$profilename

echo &quot;The client profile is located at /etc/openvpn/client/$profilename&quot;
</code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Backup multiple database]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>DECLARE @prefix VARCHAR(64) = &apos;Dev_LDS_Dev_LSS&apos;
DECLARE @path VARCHAR(256) = &apos;E:\DB_Backup\Alex\&apos;

DECLARE @dbname VARCHAR(256)
DECLARE @filename VARCHAR(256)
DECLARE @date VARCHAR(32)

SELECT @date = CONVERT(VARCHAR(20),GETDATE(),112)

DECLARE db_cursor CURSOR FOR
	SELECT [name]
	FROM sys.databases WHERE</code></pre>]]></description><link>https://blog.ourdark.org/backup-multiple-database/</link><guid isPermaLink="false">6487d03025a2f00001d05b83</guid><category><![CDATA[Mannual]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 13 Jun 2023 02:11:14 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>DECLARE @prefix VARCHAR(64) = &apos;Dev_LDS_Dev_LSS&apos;
DECLARE @path VARCHAR(256) = &apos;E:\DB_Backup\Alex\&apos;

DECLARE @dbname VARCHAR(256)
DECLARE @filename VARCHAR(256)
DECLARE @date VARCHAR(32)

SELECT @date = CONVERT(VARCHAR(20),GETDATE(),112)

DECLARE db_cursor CURSOR FOR
	SELECT [name]
	FROM sys.databases WHERE [name] like @prefix + &apos;%&apos;

OPEN db_cursor

FETCH NEXT FROM db_cursor INTO @dbname

	WHILE @@FETCH_STATUS = 0
		BEGIN
			SET @filename = @path + @dbname + &apos;_&apos; + @date + &apos;.bak&apos;
			BACKUP DATABASE @dbname TO DISK = @filename
			PRINT @filename
			FETCH NEXT FROM db_cursor INTO @dbname
		END

CLOSE db_cursor
DEALLOCATE db_cursor </code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Recover a database]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>ALTER DATABASE [DBName] SET EMERGENCY;
GO
ALTER DATABASE [DBName] set single_user
GO
DBCC CHECKDB ([DBName], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE [DBName] set multi_user
GO</code></pre><!--kg-card-end: markdown-->]]></description><link>https://blog.ourdark.org/recover-a-database/</link><guid isPermaLink="false">6487cff525a2f00001d05b78</guid><category><![CDATA[Mannual]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 13 Jun 2023 02:10:22 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>ALTER DATABASE [DBName] SET EMERGENCY;
GO
ALTER DATABASE [DBName] set single_user
GO
DBCC CHECKDB ([DBName], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE [DBName] set multi_user
GO</code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Find table in databases]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>DECLARE @prefix VARCHAR(64) = &apos;Dev_LDS_Dev_LSS&apos;
DECLARE @dbname VARCHAR(256)
DECLARE @statement VARCHAR(MAX)
DECLARE @sql VARCHAR(MAX)

DECLARE db_cursor CURSOR FOR
	SELECT [name]
	FROM sys.databases WHERE [name] like @prefix + &apos;%&apos;

OPEN db_cursor

FETCH NEXT FROM db_cursor INTO @dbname

	WHILE @@FETCH_</code></pre>]]></description><link>https://blog.ourdark.org/find-table-in-databases/</link><guid isPermaLink="false">6487cfa825a2f00001d05b6c</guid><category><![CDATA[Mannual]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 13 Jun 2023 02:09:05 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>DECLARE @prefix VARCHAR(64) = &apos;Dev_LDS_Dev_LSS&apos;
DECLARE @dbname VARCHAR(256)
DECLARE @statement VARCHAR(MAX)
DECLARE @sql VARCHAR(MAX)

DECLARE db_cursor CURSOR FOR
	SELECT [name]
	FROM sys.databases WHERE [name] like @prefix + &apos;%&apos;

OPEN db_cursor

FETCH NEXT FROM db_cursor INTO @dbname

	WHILE @@FETCH_STATUS = 0
		BEGIN
			SET @statement = &apos;SELECT &apos;&apos;&apos; + @dbname+&apos;&apos;&apos; AS db, convert(VARCHAR(MAX),[name]) COLLATE SQL_Latin1_General_CP1_CI_AS AS tb FROM &apos; + @dbname +&apos;.sys.tables where name like &apos;&apos;%CAWorkshopPriceList%&apos;&apos;&apos;
			--SET @statement = &apos;IF EXISTS(&apos;+ @statement + &apos;) &apos; + @statement
			SET @sql = @sql + &apos; UNION ALL&apos; + CHAR(13)
			SET @sql = ISNULL(@sql,&apos;&apos;) + @statement
			--PRINT @sql
			
			FETCH NEXT FROM db_cursor INTO @dbname
		END

CLOSE db_cursor
DEALLOCATE db_cursor 

PRINT @sql
EXECUTE(@sql)
</code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[how to check table dependence sequence in ms sql]]></title><description><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>set nocount on

drop table if exists #reduce;
drop table if exists #depend;

create table #depend(
	id int identity(1,1),
	t_t int
)

declare @round int = 1

select parent_object_id as s_t,referenced_object_id as t_t into #reduce from sys.foreign_key_columns
insert into</code></pre>]]></description><link>https://blog.ourdark.org/how-to-check-table-dependence-sequence-in-ms-sql/</link><guid isPermaLink="false">6486cd1225a2f00001d05b5a</guid><category><![CDATA[Mannual]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Mon, 12 Jun 2023 07:46:10 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><pre class="language-sql"><code>set nocount on

drop table if exists #reduce;
drop table if exists #depend;

create table #depend(
	id int identity(1,1),
	t_t int
)

declare @round int = 1

select parent_object_id as s_t,referenced_object_id as t_t into #reduce from sys.foreign_key_columns
insert into #depend select object_id as t_t from sys.tables where object_id not in (select s_t from #reduce) and object_id not in (select t_t from #reduce)

--select (select count(*) from #reduce) a,(select count(*) from #depend) b,(select count(distinct t_t) from #depend) b1, (select count(*) from sys.tables) c, &apos;out&apos;
--select #depend.id,sys.tables.name from #depend left join sys.tables on #depend.t_t = sys.tables.object_id

insert into #depend select distinct a1.t_t as t_t from #reduce a1 left join #reduce a2 on a1.t_t = a2.s_t where a2.s_t is null 
insert into #depend select distinct a1.s_t as t_t from #reduce a1 where a1.t_t in (select t_t from #depend) and a1.s_t not in (select t_t from #reduce) and a1.s_t not in (select t_t from #depend)
delete from #reduce where #reduce.t_t in (select t_t from #depend)

--select (select count(*) from #reduce) a,(select count(*) from #depend) b,(select count(distinct t_t) from #depend) b1, (select count(*) from sys.tables) c , &apos;out&apos;
--select #depend.id,sys.tables.name from #depend left join sys.tables on #depend.t_t = sys.tables.object_id
/*
select * from #depend
select * from #reduce
*/

declare @count int = 100
select @count = count(*) from #reduce

while(@count&gt;0)
begin 
	insert into #depend select distinct a1.t_t as t_t from #reduce a1 left join #reduce a2 on a1.t_t = a2.s_t where a2.s_t is null 
	insert into #depend select distinct a1.s_t as t_t from #reduce a1 where a1.t_t in (select t_t from #depend) and a1.s_t not in (select t_t from #reduce) and a1.s_t not in (select t_t from #depend)
	delete from #reduce where #reduce.t_t in (select t_t from #depend)

	--select (select count(*) from #reduce) a,(select count(*) from #depend) b,(select count(distinct t_t) from #depend) b1, (select count(*) from sys.tables) c, @round
	--select #depend.id,sys.tables.name from #depend left join sys.tables on #depend.t_t = sys.tables.object_id

	select @count = count(*) from #reduce
	set @round = @round + 1
end

print cast(@round as varchar(7)) + &apos; round to finished&apos;

select #depend.id,sys.tables.name from #depend left join sys.tables on #depend.t_t = sys.tables.object_id order by #depend.id
select * from sys.tables where object_id not in (select t_t from #depend)

drop table if exists #reduce;
drop table if exists #depend;

set nocount off

</code></pre><!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install Dgraph with docker]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p><a href="https://hub.docker.com/r/dgraph/dgraph">Official</a> docker images<br>
<a href="https://github.com/dgraph-io/dgraph">Github</a> open source code</p>
<!--kg-card-end: markdown--><p>Install with docker-composite, &#xA0;docker-compose.yml</p><!--kg-card-begin: markdown--><p><a href="https://github.com/dgraph-io/dgraph/tree/master/contrib/config/docker">Config</a> documents</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>version: &quot;3.2&quot;
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5180
  alpha:
    image: dgraph/dgraph:</code></pre>]]></description><link>https://blog.ourdark.org/install-dgraph-with-docker/</link><guid isPermaLink="false">62301eab64b2890001dc40aa</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Wed, 09 Mar 2022 07:30:55 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p><a href="https://hub.docker.com/r/dgraph/dgraph">Official</a> docker images<br>
<a href="https://github.com/dgraph-io/dgraph">Github</a> open source code</p>
<!--kg-card-end: markdown--><p>Install with docker-composite, &#xA0;docker-compose.yml</p><!--kg-card-begin: markdown--><p><a href="https://github.com/dgraph-io/dgraph/tree/master/contrib/config/docker">Config</a> documents</p>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>version: &quot;3.2&quot;
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5180
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080
  ratel:
    image: dgraph/ratel
    ports:
      - 8000:8000
    command: dgraph-ratel</code></pre><!--kg-card-end: markdown--><p>Start with docker-composite</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker-compose up -d</code></pre><!--kg-card-end: markdown--><p>Access http://:8000</p>]]></content:encoded></item><item><title><![CDATA[Install kafka cluster]]></title><description><![CDATA[<!--kg-card-begin: markdown--><p>The prerequisite:<br>
before you can install kafka you are required java jdk8+ installed, there is an old post <a href="https://blog.ourdark.org/jdkan-zhuang/">reference</a><br>
Alternative, you could use package tools like yum to install jdk as well.</p>
<p>Kafka require zookeeper for now, the <a href="https://blog.ourdark.org/install-zookeeper-with/">article</a> inlustrate how to install zk cluster</p>
<!--kg-card-end: markdown--><p>Download binary with curl, or</p>]]></description><link>https://blog.ourdark.org/install-kafka-cluster/</link><guid isPermaLink="false">62301eab64b2890001dc40a9</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Mon, 24 Jan 2022 06:35:22 GMT</pubDate><content:encoded><![CDATA[<!--kg-card-begin: markdown--><p>The prerequisite:<br>
before you can install kafka you are required java jdk8+ installed, there is an old post <a href="https://blog.ourdark.org/jdkan-zhuang/">reference</a><br>
Alternative, you could use package tools like yum to install jdk as well.</p>
<p>Kafka require zookeeper for now, the <a href="https://blog.ourdark.org/install-zookeeper-with/">article</a> inlustrate how to install zk cluster</p>
<!--kg-card-end: markdown--><p>Download binary with curl, or use wget you like</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>curl -O https://dlcdn.apache.org/kafka/3.0.0/kafka_2.13-3.0.0.tgz</code></pre><!--kg-card-end: markdown--><p>un-tar tarball</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>tar -xzf kafka_2.13-3.0.0.tgz</code></pre><!--kg-card-end: markdown--><p>change dir to kafka</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>cd kafka_2.13-3.0.0</code></pre><!--kg-card-end: markdown--><p>Create log dir</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mkdir /data/kafka/kafka-logs</code></pre><!--kg-card-end: markdown--><p>Backup your config template files</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>cp config/server.properties config/server.properties.template</code></pre><!--kg-card-end: markdown--><p>Edit config file config/server.properties, modify highlight lines according to your fit.</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>vim config/server.properties</code></pre><!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-bash line-numbers"><code># Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the &quot;License&quot;); 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# see kafka.server.KafkaConfig for additional details and defaults

############################# Server Basics #############################

# The id of the broker. This must be set to a unique integer for each broker.
broker.id=<mark>0</mark>

############################# Socket Server Settings #############################

# The address the socket server listens on. It will get the value returned from 
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
#listeners=PLAINTEXT://:9092

# Hostname and port the broker will advertise to producers and consumers. If not set, 
# it uses the value for &quot;listeners&quot; if configured.  Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
#advertised.listeners=PLAINTEXT://your.host.name:9092

# Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
#listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL

# The number of threads that the server uses for receiving requests from the network and sending responses to the network
num.network.threads=3

# The number of threads that the server uses for processing requests, which may include disk I/O
num.io.threads=8

# The send buffer (SO_SNDBUF) used by the socket server
socket.send.buffer.bytes=102400

# The receive buffer (SO_RCVBUF) used by the socket server
socket.receive.buffer.bytes=102400

# The maximum size of a request that the socket server will accept (protection against OOM)
socket.request.max.bytes=104857600


############################# Log Basics #############################

# A comma separated list of directories under which to store log files
log.dirs=<mark>/data/kafka/kafka-logs</mark>

# The default number of log partitions per topic. More partitions allow greater
# parallelism for consumption, but this will also result in more files across
# the brokers.
num.partitions=8

# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
# This value is recommended to be increased for installations with data dirs located in RAID array.
num.recovery.threads.per.data.dir=2

############################# Internal Topic Settings  #############################
# The replication factor for the group metadata internal topics &quot;__consumer_offsets&quot; and &quot;__transaction_state&quot;
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.
offsets.topic.replication.factor=3
transaction.state.log.replication.factor=3
transaction.state.log.min.isr=3

############################# Log Flush Policy #############################

# Messages are immediately written to the filesystem but by default we only fsync() to sync
# the OS cache lazily. The following configurations control the flush of data to disk.
# There are a few important trade-offs here:
#    1. Durability: Unflushed data may be lost if you are not using replication.
#    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
#    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.
# The settings below allow one to configure the flush policy to flush data after a period of time or
# every N messages (or both). This can be done globally and overridden on a per-topic basis.

# The number of messages to accept before forcing a flush of data to disk
#log.flush.interval.messages=10000

# The maximum amount of time a message can sit in a log before we force a flush
#log.flush.interval.ms=1000

############################# Log Retention Policy #############################

# The following configurations control the disposal of log segments. The policy can
# be set to delete segments after a period of time, or after a given size has accumulated.
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
# from the end of the log.

# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168

# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
#log.retention.bytes=1073741824

# The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=1073741824

# The interval at which log segments are checked to see if they can be deleted according
# to the retention policies
log.retention.check.interval.ms=300000

############################# Zookeeper #############################

# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. &quot;127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002&quot;.
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zookeeper.connect=<mark>link1:2181,link2:2181</mark>

# Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=18000


############################# Group Coordinator Settings #############################

# The following configuration specifies the time, in milliseconds, that the GroupCoordinator will delay the initial consumer rebalance.
# The rebalance will be further delayed by the value of group.initial.rebalance.delay.ms as new members join the group, up to a maximum of max.poll.interval.ms.
# The default value for this is 3 seconds.
# We override this to 0 here as it makes for a better out-of-the-box experience for development and testing.
# However, in production environments the default value of 3 seconds is more suitable as this will help to avoid unnecessary, and potentially expensive, rebalances during application startup.
group.initial.rebalance.delay.ms=30000</code></pre><!--kg-card-end: markdown--><p>for more detaild config settings(such like topic delete enable), find document here:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://kafka.apache.org/documentation/#brokerconfigs"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Apache Kafka</div><div class="kg-bookmark-description">Apache Kafka: A Distributed Streaming Platform.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://kafka.apache.org/images/apache_feather.gif" alt><span class="kg-bookmark-author">Apache Kafka</span></div></div><div class="kg-bookmark-thumbnail"><img src="http://apache-kafka.org/images/apache-kafka.png" alt></div></a></figure><p>then start kafka cluster</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>nohup ./bin/kafka-server-start.sh config/server.properties &amp;</code></pre><!--kg-card-end: markdown--><!--kg-card-begin: markdown--><p>you can wrap your binary as auto start service, check <a href="https://blog.ourdark.org/auto-start-service/">here</a></p>
<!--kg-card-end: markdown--><p>repeat all above step on each node, your kafka cluster is online.</p><p>Now test your cluster:</p><p>Topics</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>#Create topic
bin/kafka-topics.sh --create --partitions 1 --replication-factor 1 --topic hello --bootstrap-server localhost:9092
#Check topic
bin/kafka-topics.sh --describe --topic hello --bootstrap-server localhost:9092</code></pre><!--kg-card-end: markdown--><p>Producer and Consumer</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>#Start producer
bin/kafka-console-producer.sh --topic hello --bootstrap-server localhost:9092
#Start consumer
bin/kafka-console-consumer.sh --topic hello --from-beginning --bootstrap-server localhost:9092</code></pre><!--kg-card-end: markdown--><p>Check broker registered if you like</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>./bin/zookeeper-shell.sh localhost:2181 ls /brokers/ids</code></pre><!--kg-card-end: markdown--><p>You can login to zookeeper to get more info</p><p>It&apos;s done!</p><p>[Reference]</p><p><a href="https://data-flair.training/blogs/kafka-cluster/">https://data-flair.training/blogs/kafka-cluster/</a></p>]]></content:encoded></item><item><title><![CDATA[Install zookeeper cluster with docker]]></title><description><![CDATA[<p>Start docker on each node, change &#xA0;ZOO_MY_ID accordingly</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line="4" data-user="ourdark" data-host="ourdark.org" data-output><code>sudo docker run --net=host -d \
    --name zk \
    --restart always \
    -e ZOO_MY_ID=1 \
    -e ZOO_SERVERS=&quot;server.1=link1:2888:3888;2181 server.2=link2:2888:3888;2181&quot; \
    zookeeper</code></pre><!--kg-card-end: markdown--><p>now you can access zookeeper command</p>]]></description><link>https://blog.ourdark.org/install-zookeeper-with/</link><guid isPermaLink="false">62301eab64b2890001dc40a8</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Thu, 20 Jan 2022 06:34:47 GMT</pubDate><content:encoded><![CDATA[<p>Start docker on each node, change &#xA0;ZOO_MY_ID accordingly</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line="4" data-user="ourdark" data-host="ourdark.org" data-output><code>sudo docker run --net=host -d \
    --name zk \
    --restart always \
    -e ZOO_MY_ID=1 \
    -e ZOO_SERVERS=&quot;server.1=link1:2888:3888;2181 server.2=link2:2888:3888;2181&quot; \
    zookeeper</code></pre><!--kg-card-end: markdown--><p>now you can access zookeeper command via web:</p><p><a href="http://link2.const.cc:8080/commands/">http://link2.const.cc:8080/commands/</a></p><p>On each node: </p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker exec -it zk /bin/bash
zkCli.sh</code></pre><!--kg-card-end: markdown--><p>on server link1, create a node /zk_test and set string value &quot;my_data&quot;</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2"><code>create /zk_test my_data
Created /zk_test</code></pre><!--kg-card-end: markdown--><p>on link2, get node value of /zk_test</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2"><code>get /zk_test 
my_data</code></pre><!--kg-card-end: markdown--><p>then clean up test code on one of nodes.</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2"><code>delete /zk_test</code></pre><!--kg-card-end: markdown--><p>note: this example only setup 2 nodes on server, you could startup your cluster as many as you want.</p>]]></content:encoded></item><item><title><![CDATA[Install Emqx with docker]]></title><description><![CDATA[<p>Firewall configurations, disable firewalld for quick in this example, you might want add ports through firewall.</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>systemctl stop firewalld
systemctl disable firewalld</code></pre><!--kg-card-end: markdown--><p>Then make nodes know each other</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2-3"><code>vim /etc/hosts
192.168.0.227 link1
192.168.0.228 link2</code></pre><!--kg-card-end: markdown--><p>The emqx.conf is config of emqx, content(default</p>]]></description><link>https://blog.ourdark.org/install-emqx-with-docker/</link><guid isPermaLink="false">62301eab64b2890001dc40a7</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 18 Jan 2022 06:52:57 GMT</pubDate><content:encoded><![CDATA[<p>Firewall configurations, disable firewalld for quick in this example, you might want add ports through firewall.</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>systemctl stop firewalld
systemctl disable firewalld</code></pre><!--kg-card-end: markdown--><p>Then make nodes know each other</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2-3"><code>vim /etc/hosts
192.168.0.227 link1
192.168.0.228 link2</code></pre><!--kg-card-end: markdown--><p>The emqx.conf is config of emqx, content(default ) is huge and you can copy it from flollowing site:</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/emqx/emqx/blob/main-v4.3/etc/emqx.conf"><div class="kg-bookmark-content"><div class="kg-bookmark-title">emqx/emqx.conf at main-v4.3 &#xB7; emqx/emqx</div><div class="kg-bookmark-description">An Open-Source, Cloud-Native, Distributed MQTT Message Broker for IoT. - emqx/emqx.conf at main-v4.3 &#xB7; emqx/emqx</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.com/fluidicon.png" alt><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">emqx</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/b74c179a19b85d99222ec4fb664f97776baa465272e65c874caf1f02305d5a99/emqx/emqx" alt></div></a></figure><p>Or you can copy it with docker:</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -d --name emqx --rm emqx/emqx
docker cp emqx:/opt/emqx/etc .
docker rm -f emqx</code></pre><!--kg-card-end: markdown--><p>Then start emqx container on each node(change the highlight line according to you nodes):</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -tid --name emqx --restart=always --network host \
    -e EMQX_NAME=<mark>link1</mark> \
    -e EMQX_HOST=<mark>192.168.0.227</mark> \
    -e EMQX_LISTENER__TCP__EXTERNAL=1883 \
    -e EMQX_WAIT_TIME=30 \
    -e EMQX_JOIN_CLUSTER=&quot;<mark>link1@192.168.0.227</mark>&quot; \
    -e EMQX_CLUSTER__NAME=emqxcl \
    -e EMQX_CLUSTER__DISCOVERY=static \
    -e EMQX_CLUSTER__STATIC__SEEDS=&quot;<mark>link1@192.168.0.227,link2@192.168.0.228</mark>&quot; \
    emqx/emqx</code></pre><!--kg-card-end: markdown--><p>Check running status</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2-28"><code>docker logs -f emqx
cluster.discovery = &quot;static&quot;
cluster.name = &quot;emqxcl&quot;
cluster.static.seeds = &quot;link1@192.168.0.227,link2@192.168.0.228&quot;
listener.ssl.external.acceptors = &quot;32&quot;
listener.ssl.external.max_connections = &quot;102400&quot;
listener.tcp.external = &quot;1883&quot;
listener.tcp.external.acceptors = &quot;64&quot;
listener.tcp.external.max_connections = &quot;1024000&quot;
listener.ws.external.acceptors = &quot;16&quot;
listener.ws.external.max_connections = &quot;102400&quot;
listener.wss.external.acceptors = &quot;16&quot;
listener.wss.external.max_connections = &quot;102400&quot;
log.to = &quot;console&quot;
node.max_ets_tables = &quot;2097152&quot;
node.max_ports = &quot;1048576&quot;
node.name = &quot;link1@192.168.0.227&quot;
node.process_limit = &quot;2097152&quot;
rpc.port_discovery = &quot;manual&quot;
Starting emqx on node link1@192.168.0.227
Start http:management listener on 8081 successfully.
Start http:dashboard listener on 18083 successfully.
Start mqtt:tcp:internal listener on 127.0.0.1:11883 successfully.
Start mqtt:tcp:external listener on 0.0.0.0:1883 successfully.
Start mqtt:ws:external listener on 0.0.0.0:8083 successfully.
Start mqtt:ssl:external listener on 0.0.0.0:8883 successfully.
Start mqtt:wss:external listener on 0.0.0.0:8084 successfully.
EMQ X Broker 4.3.8 is running now!</code></pre><!--kg-card-end: markdown--><p>Check cluster status via</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="2-4"><code>docker exec -it emqx /bin/sh /opt/emqx/bin/emqx_ctl cluster status
Cluster status: #{running_nodes =&gt;
                      [&apos;link1@192.168.0.227&apos;,&apos;link2@192.168.0.228&apos;],
                  stopped_nodes =&gt; []}</code></pre><!--kg-card-end: markdown--><p>Open webbrowser, access site</p><blockquote><a href="http://link1.const.cc:18083">http://link1.const.cc:18083</a></blockquote><blockquote>user: admin </blockquote><blockquote>password: public</blockquote><p></p>]]></content:encoded></item><item><title><![CDATA[Install influx & telegraf with docker]]></title><description><![CDATA[<h2 id="install-influxdb">Install InfluxDB</h2><ul><li>Create network for dockers, it&apos;s better you create network for the dockers, then you can access docker with name</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker network create IoT</code></pre><!--kg-card-end: markdown--><ul><li>Create /data and /data/influx dir for docker volume</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mkdir /data
mkdir /data/influx</code></pre><!--kg-card-end: markdown--><ul><li>Start influxDB with docker, The official docker image <a href="https://hub.docker.com/_/influxdb">here</a></li></ul>]]></description><link>https://blog.ourdark.org/install-influx/</link><guid isPermaLink="false">62301eab64b2890001dc40a5</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Tue, 04 Jan 2022 07:06:13 GMT</pubDate><content:encoded><![CDATA[<h2 id="install-influxdb">Install InfluxDB</h2><ul><li>Create network for dockers, it&apos;s better you create network for the dockers, then you can access docker with name</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker network create IoT</code></pre><!--kg-card-end: markdown--><ul><li>Create /data and /data/influx dir for docker volume</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mkdir /data
mkdir /data/influx</code></pre><!--kg-card-end: markdown--><ul><li>Start influxDB with docker, The official docker image <a href="https://hub.docker.com/_/influxdb">here</a></li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -p 8086:8086 \
    -v /data/influx/influxdb:/var/lib/influxdb \
    -v /data/influx/influxdb2:/var/lib/influxdb2 \
    -v /data/influx/influxdb2-config:/etc/influxdb2 \
    -v /data/influx/influxdb.conf:/etc/influxdb/influxdb.conf \
    -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
    -e DOCKER_INFLUXDB_INIT_PASSWORD=ConST \
    -e DOCKER_INFLUXDB_INIT_ORG=ConST \
    -e DOCKER_INFLUXDB_INIT_BUCKET=bucket \
    -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=123 \
    --network=IoT \
    -d \
    --restart always \
    --name influx \
    influxdb</code></pre><!--kg-card-end: markdown--><ul><li>Now access https://ourdark.org:8086</li></ul><h2 id="install-telegraf">Install telegraf</h2><ul><li>Create telegraf dir</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mkdir /data/telegraf</code></pre><!--kg-card-end: markdown--><ul><li>Switch to /data/telegraf folder</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>cd /data/telegraf</code></pre><!--kg-card-end: markdown--><ul><li>Before you can mount local config file to telegraf, make sure there is telegraf.conf exists</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run --rm telegraf telegraf config &gt; telegraf.conf</code></pre><!--kg-card-end: markdown--><p> &#xA0; &#xA0; &#xA0; &#xA0;telegraf.conf is auto generated under /data/telegraf/ folder, then edit the config you want, mine will like this.</p><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>vim telegraf.conf</code></pre><!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-bash line-numbers" data-line="14-17"><code># Configuration
[agent]
  interval = &quot;10s&quot;
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = &quot;0s&quot;
  flush_interval = &quot;10s&quot;
  flush_jitter = &quot;0s&quot;
  precision = &quot;&quot;
  hostname = &quot;&quot;
  omit_hostname = false
[[outputs.influxdb_v2]]
  urls = [&quot;<mark>http://link1.const.cc:8086</mark>&quot;]
  token = &quot;yDLG7pUZbX5uCTMf6Qnopd62yOkhazUMeRco3sP3m6syHnn0nGS1xyj-vA3f7YinUYWH6J5pwH7_YMOu0HaKiQ==&quot;
  organization = &quot;ConST&quot;
  bucket = &quot;Default&quot;
[[inputs.cpu]]
  percpu = true
  totalcpu = true
  collect_cpu_time = false
  report_active = false
[[inputs.disk]]
  ignore_fs = [&quot;tmpfs&quot;, &quot;devtmpfs&quot;, &quot;devfs&quot;, &quot;iso9660&quot;, &quot;overlay&quot;, &quot;aufs&quot;, &quot;squashfs&quot;]
[[inputs.diskio]]
[[inputs.mem]]
[[inputs.net]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
</code></pre><!--kg-card-end: markdown--><p> &#xA0; &#xA0; &#xA0; &#xA0;You can get information from https://ourdark.org:8086, navigate to data-&gt;telegraf, then create configuration with system plugin</p><ul><li>Now you can start telegraf docker </li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line line-number" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -v $PWD/telegraf.conf:/etc/telegraf/telegraf.conf:ro \
    --restart always \
    --name=telegraf \
    -d  \
    telegraf</code></pre><!--kg-card-end: markdown--><p> &#xA0; &#xA0; &#xA0; It should say &quot;connected&quot; after a little while, the system monitor dashboard will auto created and loaded.</p>]]></content:encoded></item><item><title><![CDATA[How to install MQTT with docker]]></title><description><![CDATA[<p>The official dockerhub <a href="https://hub.docker.com/_/eclipse-mosquitto">link</a>.</p><ul><li>Create config file mosquitto.conf under /data/mosquitto/config/</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code># allow_anonymous true
listener 1883
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
password_file /mosquitto/pwd*</code></pre><!--kg-card-end: markdown--><ul><li>Create file pwd under /mosquitto/ in docker</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>touch pwd</code></pre><!--kg-card-end: markdown--><ul><li>Add user for pwd</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mosquitto_passwd</code></pre>]]></description><link>https://blog.ourdark.org/mqtt/</link><guid isPermaLink="false">62301eab64b2890001dc40a4</guid><category><![CDATA[Getting Started]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Thu, 23 Dec 2021 09:42:07 GMT</pubDate><content:encoded><![CDATA[<p>The official dockerhub <a href="https://hub.docker.com/_/eclipse-mosquitto">link</a>.</p><ul><li>Create config file mosquitto.conf under /data/mosquitto/config/</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code># allow_anonymous true
listener 1883
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
password_file /mosquitto/pwd*</code></pre><!--kg-card-end: markdown--><ul><li>Create file pwd under /mosquitto/ in docker</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>touch pwd</code></pre><!--kg-card-end: markdown--><ul><li>Add user for pwd</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>mosquitto_passwd -c /mosquitto/pwd root</code></pre><!--kg-card-end: markdown--><ul><li>Execute following line to start mqtt docker container</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -it -d --name mosquitto -v /data/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /data/mosquitto/data:/mosquitto/data -v /data/mosquitto/log:/mosquitto/log --restart always -p 1883:1883 -p 9001:9001 eclipse-mosquitto</code></pre><!--kg-card-end: markdown--><h4 id="now-you-can-use-cli-to-test-your-mqtt">Now you can use cli to test your mqtt</h4><ul><li>Subscribe data</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run --rm hivemq/mqtt-cli sub -t &apos;#&apos; -h ourdark.org -u root -pw Forhuman1999@</code></pre><!--kg-card-end: markdown--><ul><li>publish message</li></ul><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run --rm -it hivemq/mqtt-cli pub -t test -h ourdark.org -m &quot;aaa&quot;</code></pre><!--kg-card-end: markdown--><p>or </p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run --rm -it hivemq/mqtt-cli shell
con -i test -h ourdark.org
pub -t test -m &quot;aaa&quot;</code></pre><!--kg-card-end: markdown--><h4 id="enable-websocket">Enable Websocket</h4><p>Add flollowing lines to config file:</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output="1-2"><code>listener 8080
protocol websockets</code></pre><!--kg-card-end: markdown--><p>Then restart docker and expose port 8080</p><!--kg-card-begin: markdown--><pre class="language-bash command-line" data-line data-user="ourdark" data-host="ourdark.org" data-output><code>docker run -it -d --name mosquitto -v /data/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /data/mosquitto/data:/mosquitto/data -v /data/mosquitto/log:/mosquitto/log --restart always -p 1883:1883 -p 9001:9001 -p 8080:8080 eclipse-mosquitto</code></pre><!--kg-card-end: markdown--><p>Well, you can use your single node mqqt server, it support mqtt and websocket protocol now.</p>]]></content:encoded></item><item><title><![CDATA[Amazon EC2 root login]]></title><description><![CDATA[<ul><li>Create ec2 instance</li><li>Xshell login</li></ul><!--kg-card-begin: markdown--><blockquote>
<p>ec2-user with rsa</p>
</blockquote>
<!--kg-card-end: markdown--><p>sudo su</p><blockquote>Init your password for root user</blockquote><p>passwd</p><blockquote>change ssh config enable root login</blockquote><p>vim /etc/ssh/sshd_config</p><pre><code>PermitRootLogin yes
PasswordAuthentication yes</code></pre><blockquote>Restart sshd</blockquote><p>service sshd restart</p><p>Then you can login amazon ec2 with root user</p>]]></description><link>https://blog.ourdark.org/install-vpn-on-amason/</link><guid isPermaLink="false">62301eab64b2890001dc40a2</guid><category><![CDATA[Basic]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Fri, 17 Dec 2021 07:06:41 GMT</pubDate><content:encoded><![CDATA[<ul><li>Create ec2 instance</li><li>Xshell login</li></ul><!--kg-card-begin: markdown--><blockquote>
<p>ec2-user with rsa</p>
</blockquote>
<!--kg-card-end: markdown--><p>sudo su</p><blockquote>Init your password for root user</blockquote><p>passwd</p><blockquote>change ssh config enable root login</blockquote><p>vim /etc/ssh/sshd_config</p><pre><code>PermitRootLogin yes
PasswordAuthentication yes</code></pre><blockquote>Restart sshd</blockquote><p>service sshd restart</p><p>Then you can login amazon ec2 with root user</p>]]></content:encoded></item><item><title><![CDATA[《我的信仰》-爱因斯坦]]></title><description><![CDATA[<p></p><p>&#x5BFC;&#x8BED;&#xFF1A;&#x79D1;&#x5B66;&#x4E4B;&#x51A0;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x662F;&#x8FC4;&#x4ECA;&#x4E3A;&#x6B62;&#x6700;&#x5353;&#x8D8A;&#x7684;&#x79D1;&#x5B66;&#x5BB6;&#x548C;&#x601D;&#x60F3;&#x5BB6;&#xFF0C;&#x662F;&#x73B0;&#x4EE3;&#x7269;&#x7406;&#x5B66;&#x7684;&#x5F00;&#x521B;&#x8005;&#x548C;&#x5960;&#x57FA;&#x4EBA;&#xFF0C;&#x4ED6;&#x7684;&#x76F8;&#x5BF9;&#x8BBA;&#xFF0C;&#x91CF;</p>]]></description><link>https://blog.ourdark.org/wo-de-xin-yang-ai-yin-si-tan/</link><guid isPermaLink="false">62301eab64b2890001dc409d</guid><category><![CDATA[Story]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Mon, 31 May 2021 09:25:19 GMT</pubDate><content:encoded><![CDATA[<p></p><p>&#x5BFC;&#x8BED;&#xFF1A;&#x79D1;&#x5B66;&#x4E4B;&#x51A0;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x662F;&#x8FC4;&#x4ECA;&#x4E3A;&#x6B62;&#x6700;&#x5353;&#x8D8A;&#x7684;&#x79D1;&#x5B66;&#x5BB6;&#x548C;&#x601D;&#x60F3;&#x5BB6;&#xFF0C;&#x662F;&#x73B0;&#x4EE3;&#x7269;&#x7406;&#x5B66;&#x7684;&#x5F00;&#x521B;&#x8005;&#x548C;&#x5960;&#x57FA;&#x4EBA;&#xFF0C;&#x4ED6;&#x7684;&#x76F8;&#x5BF9;&#x8BBA;&#xFF0C;&#x91CF;&#x5B50;&#x529B;&#x8BBA;&#x4EE5;&#x53CA;&#x7EDF;&#x4E00;&#x573A;&#x8BBA;&#x4E09;&#x5927;&#x5B9A;&#x7406;&#x662F;&#x5176;&#x5728;&#x7279;&#x80FD;&#x72B6;&#x6001;&#x4E4B;&#x5927;&#x6210;&#xFF0C;&#x4E8E;&#x4E16;&#x65E0;&#x61C8;&#x53EF;&#x51FB;&#x3002;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x5728;&#x4E8C;&#x5341;&#x4E16;&#x7EAA;&#x521D;&#x5EFA;&#x7ACB;&#x76F8;&#x5BF9;&#x8BBA;&#x7684;&#x4F1F;&#x5927;&#x521B;&#x89C1;&#xFF0C;&#x4E8E;&#x4E2D;&#x5E74;&#x83B7;&#x9053;&#xFF0C;&#x665A;&#x5E74;&#x8457;&#x4F5C;&#x5168;&#x96C6;&#x5E76;&#x6CA1;&#x6709;&#x95EE;&#x4E16;&#xFF0C;&#x4E00;&#x65E6;&#x516C;&#x4E4B;&#x4E8E;&#x4F17;&#x5FC5;&#x5C06;&#x5F15;&#x8D77;&#x8F70;&#x52A8;&#x3002; &#x5728;&#x8FD9;&#x7BC7;&#x6587;&#x7AE0;&#x4E2D;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x4EE5;&#x4E00;&#x4E2A;&#x79D1;&#x5B66;&#x5BB6;&#x7684;&#x8BDA;&#x5B9E;&#x548C;&#x7B80;&#x6D01;&#x8BF4;&#x660E;&#x4E86;&#x4EBA;&#x751F;&#x89C2;&#xFF0C;&#x653F;&#x6CBB;&#x89C2;&#xFF0C;&#x5B97;&#x6559;&#x89C2;&#x3002;&#x5728;&#x73B0;&#x4ECA;&#x8FD9;&#x4E2A;&#x7269;&#x6B32;&#x6A2A;&#x6D41;&#x9053;&#x5FB7;&#x7F3A;&#x5931;&#x4FE1;&#x4EF0;&#x5371;&#x673A;&#x7684;&#x65F6;&#x4EE3;&#x4E0B;&#xFF0C;&#x8FD9;&#x6837;&#x632F;&#x804B;&#x53D1;&#x8069;&#x7684;&#x6587;&#x5B57;&#x548C;&#x601D;&#x60F3;&#x8D8A;&#x53D1;&#x7A81;&#x663E;&#x5176;&#x8B66;&#x4E16;&#x6B63;&#x98CE;&#x548C;&#x542F;&#x8FEA;&#x5FC3;&#x7075;&#x7684;&#x4F5C;&#x7528;&#x3002;<br><br>&#x5BF9;&#x4E8E;&#x4EBA;&#x751F;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x8BF4;&#xFF1A;<br>&#x201C;&#x6211;&#x4EEC;&#x6BCF;&#x4E2A;&#x4EBA;&#x5728;&#x8FD9;&#x4E2A;&#x4E16;&#x754C;&#x4E0A;&#x90FD;&#x53EA;&#x4F5C;&#x4E00;&#x4E2A;&#x77ED;&#x6682;&#x7684;&#x9017;&#x7559;&#xFF1B;&#x76EE;&#x7684;&#x4F55;&#x5728;&#xFF0C;&#x5374;&#x65E0;&#x6240;&#x77E5;&#xFF0C;&#x5C3D;&#x7BA1;&#x6709;&#x65F6;&#x81EA;&#x4EE5;&#x4E3A;&#x5BF9;&#x6B64;&#x82E5;&#x6709;&#x6240;&#x611F;&#x3002;&#x6211;&#x6BCF;&#x5929;&#x4E0A;&#x767E;&#x6B21;&#x5730;&#x63D0;&#x9192;&#x81EA;&#x5DF1;&#xFF1A;&#x6211;&#x7684;&#x7CBE;&#x795E;&#x751F;&#x6D3B;&#x548C;&#x7269;&#x8D28;&#x751F;&#x6D3B;&#x90FD;&#x4F9D;&#x9760;&#x522B;&#x4EBA;&#xFF08;&#x5305;&#x62EC;&#x6D3B;&#x7740;&#x7684;&#x4EBA;&#x548C;&#x6B7B;&#x53BB;&#x7684;&#x4EBA;&#xFF09;&#x7684;&#x52B3;&#x52A8;&#xFF0C;&#x6211;&#x5FC5;&#x987B;&#x5C3D;&#x529B;&#x4EE5;&#x540C;&#x6837;&#x7684;&#x5206;&#x91CF;&#x6765;&#x62A5;&#x507F;&#x6211;&#x6240;&#x9886;&#x53D7;&#x4E86;&#x7684;&#x548C;&#x81F3;&#x4ECA;&#x8FD8;&#x5728;&#x9886;&#x53D7;&#x7684;&#x4E1C;&#x897F;&#x3002;&#x6BCF;&#x4E00;&#x4E2A;&#x4EBA;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x867D;&#x7136;&#x53D7;&#x7740;&#x5916;&#x754C;&#x7684;&#x5F3A;&#x8FEB;&#xFF0C;&#x6700;&#x91CD;&#x8981;&#x7684;&#x662F;&#x9002;&#x5E94;&#x5185;&#x5FC3;&#x7684;&#x5FC5;&#x7136;&#x3002;&#x8981;&#x8FFD;&#x7A76;&#x4E00;&#x4E2A;&#x4EBA;&#x81EA;&#x5DF1;&#x6216;&#x4E00;&#x5207;&#x751F;&#x7269;&#x751F;&#x5B58;&#x7684;&#x610F;&#x4E49;&#x6216;&#x76EE;&#x7684;&#xFF0C;&#x4ECE;&#x5BA2;&#x89C2;&#x7684;&#x89C2;&#x70B9;&#x770B;&#x6765;&#xFF0C;&#x6211;&#x603B;&#x89C9;&#x5F97;&#x662F;&#x611A;&#x8822;&#x53EF;&#x7B11;&#x7684;&#x3002;&#x53EF;&#x662F;&#x6BCF;&#x4E2A;&#x4EBA;&#x90FD;&#x6709;&#x4E00;&#x5B9A;&#x7684;&#x7406;&#x60F3;&#xFF0C;&#x8FD9;&#x79CD;&#x7406;&#x60F3;&#x51B3;&#x5B9A;&#x7740;&#x4ED6;&#x7684;&#x52AA;&#x529B;&#x548C;&#x5224;&#x65AD;&#x7684;&#x65B9;&#x5411;&#x3002;<br>&#x5C31;&#x5728;&#x8FD9;&#x4E2A;&#x610F;&#x4E49;&#x4E0A;&#xFF0C;&#x6211;&#x4ECE;&#x6765;&#x4E0D;&#x628A;&#x5B89;&#x9038;&#x548C;&#x4EAB;&#x4E50;&#x770B;&#x4F5C;&#x662F;&#x751F;&#x6D3B;&#x76EE;&#x7684;&#x672C;&#x8EAB;&#x2014;&#x2014;&#x8FD9;&#x79CD;&#x4F26;&#x7406;&#x57FA;&#x7840;&#xFF0C;&#x6211;&#x53EB;&#x5B83;&#x732A;&#x680F;&#x7684;&#x7406;&#x60F3;&#x3002;&#x7167;&#x4EAE;&#x6211;&#x7684;&#x9053;&#x8DEF;&#xFF0C;&#x5E76;&#x4E14;&#x4E0D;&#x65AD;&#x5730;&#x7ED9;&#x6211;&#x65B0;&#x7684;&#x52C7;&#x6C14;&#x53BB;&#x6109;&#x5FEB;&#x5730;&#x6B63;&#x89C6;&#x751F;&#x6D3B;&#x7684;&#x7406;&#x60F3;&#xFF0C;&#x662F;&#x5584;&#x3001;&#x7F8E;&#x548C;&#x771F;&#x3002;&#x8981;&#x662F;&#x6CA1;&#x6709;&#x5FD7;&#x540C;&#x9053;&#x5408;&#x8005;&#x4E4B;&#x95F4;&#x7684;&#x4EB2;&#x5207;&#x611F;&#x60C5;&#xFF0C;&#x8981;&#x4E0D;&#x662F;&#x5168;&#x795E;&#x8D2F;&#x6CE8;&#x4E8E;&#x5BA2;&#x89C2;&#x4E16;&#x754C;&#x2014;&#x2014;&#x90A3;&#x4E2A;&#x5728;&#x827A;&#x672F;&#x548C;&#x79D1;&#x5B66;&#x5DE5;&#x4F5C;&#x9886;&#x57DF;&#x91CC;&#x6C38;&#x8FDC;&#x8FBE;&#x4E0D;&#x5230;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x90A3;&#x672B;&#x5728;&#x6211;&#x770B;&#x6765;&#xFF0C;&#x751F;&#x6D3B;&#x5C31;&#x4F1A;&#x662F;&#x7A7A;&#x865A;&#x7684;&#x3002;&#x4EBA;&#x4EEC;&#x6240;&#x52AA;&#x529B;&#x8FFD;&#x6C42;&#x7684;&#x5EB8;&#x4FD7;&#x7684;&#x76EE;&#x6807;&#x2014;&#x2014;&#x8D22;&#x4EA7;&#x3001;&#x865A;&#x8363;&#x3001;&#x5962;&#x4F88;&#x7684;&#x751F;&#x6D3B;&#x2014;&#x2014;&#x6211;&#x603B;&#x89C9;&#x5F97;&#x90FD;&#x662F;&#x53EF;&#x9119;&#x7684;&#x3002;&#x6211;&#x5F3A;&#x70C8;&#x5730;&#x5411;&#x5F80;&#x7740;&#x4FED;&#x6734;&#x7684;&#x751F;&#x6D3B;&#xFF0C;&#x5E76;&#x4E14;&#x65F6;&#x5E38;&#x4E3A;&#x53D1;&#x89C9;&#x81EA;&#x5DF1;&#x5360;&#x7528;&#x4E86;&#x540C;&#x80DE;&#x7684;&#x8FC7;&#x591A;&#x52B3;&#x52A8;&#x800C;&#x96BE;&#x4EE5;&#x5FCD;&#x53D7;&#x3002;&#x7B80;&#x5355;&#x6DF3;&#x6734;&#x7684;&#x751F;&#x6D3B;&#xFF0C;&#x65E0;&#x8BBA;&#x5728;&#x8EAB;&#x4F53;&#x4E0A;&#x8FD8;&#x662F;&#x5728;&#x7CBE;&#x795E;&#x4E0A;&#xFF0C;&#x5BF9;&#x6BCF;&#x4E2A;&#x4EBA;&#x90FD;&#x662F;&#x6709;&#x76CA;&#x7684;&#x3002;&#x201D;&#x201C;&#x4E00;&#x4E2A;&#x4EBA;&#x7684;&#x771F;&#x6B63;&#x4EF7;&#x503C;&#xFF0C;&#x9996;&#x5148;&#x51B3;&#x5B9A;&#x4E8E;&#x4ED6;&#x5728;&#x4EC0;&#x4E48;&#x7A0B;&#x5EA6;&#x4E0A;&#x548C;&#x5728;&#x4EC0;&#x4E48;&#x610F;&#x4E49;&#x4E0A;&#x4ECE;&#x81EA;&#x6211;&#x89E3;&#x653E;&#x51FA;&#x6765;&#x3002;&#x201D;<br><br>&#x5BF9;&#x4E8E;&#x653F;&#x6CBB;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x8BF4;&#xFF1A;<br>&#x201C;&#x6211;&#x8BA4;&#x4E3A;&#x9636;&#x7EA7;&#x7684;&#x533A;&#x5206;&#x662F;&#x4E0D;&#x5408;&#x7406;&#x7684;&#xFF0C;&#x5B83;&#x6700;&#x540E;&#x6240;&#x51ED;&#x501F;&#x7684;&#x662F;&#x4EE5;&#x66B4;&#x529B;&#x4E3A;&#x6839;&#x636E;&#x3002;&#x6211;&#x7684;&#x653F;&#x6CBB;&#x7406;&#x60F3;&#x662F;&#x6C11;&#x4E3B;&#x4E3B;&#x4E49;&#x3002;&#x8BA9;&#x6BCF;&#x4E00;&#x4E2A;&#x4EBA;&#x90FD;&#x4F5C;&#x4E3A;&#x4E2A;&#x4EBA;&#x800C;&#x53D7;&#x5230;&#x5C0A;&#x91CD;&#xFF0C;&#x800C;&#x4E0D;&#x8BA9;&#x4EFB;&#x4F55;&#x4EBA;&#x6210;&#x4E3A;&#x5D07;&#x62DC;&#x7684;&#x5076;&#x50CF;&#x3002;&#x6211;&#x81EA;&#x5DF1;&#x53D7;&#x5230;&#x4E86;&#x4EBA;&#x4EEC;&#x8FC7;&#x5206;&#x7684;&#x8D5E;&#x626C;&#x548C;&#x5C0A;&#x656C;&#xFF0C;&#x8FD9;&#x4E0D;&#x662F;&#x7531;&#x4E8E;&#x6211;&#x81EA;&#x5DF1;&#x7684;&#x8FC7;&#x9519;&#xFF0C;&#x4E5F;&#x4E0D;&#x662F;&#x7531;&#x4E8E;&#x6211;&#x81EA;&#x5DF1;&#x7684;&#x529F;&#x52B3;&#xFF0C;&#x800C;&#x5B9E;&#x5728;&#x662F;&#x4E00;&#x79CD;&#x547D;&#x8FD0;&#x7684;&#x5632;&#x5F04;&#x3002;&#x5176;&#x539F;&#x56E0;&#x5927;&#x6982;&#x5728;&#x4E8E;&#x4EBA;&#x4EEC;&#x6709;&#x4E00;&#x79CD;&#x613F;&#x671B;&#xFF0C;&#x60F3;&#x7406;&#x89E3;&#x6211;&#x4EE5;&#x81EA;&#x5DF1;&#x7684;&#x5FAE;&#x8584;&#x7EF5;&#x529B;&#x901A;&#x8FC7;&#x4E0D;&#x65AD;&#x7684;&#x6597;&#x4E89;&#x6240;&#x83B7;&#x5F97;&#x7684;&#x5C11;&#x6570;&#x51E0;&#x4E2A;&#x89C2;&#x5FF5;&#xFF0C;&#x800C;&#x8FD9;&#x79CD;&#x613F;&#x671B;&#x6709;&#x5F88;&#x591A;&#x4EBA;&#x5374;&#x672A;&#x80FD;&#x5B9E;&#x73B0;&#x3002;&#x6211;&#x5B8C;&#x5168;&#x660E;&#x767D;&#xFF0C;&#x4E00;&#x4E2A;&#x7EC4;&#x7EC7;&#x8981;&#x5B9E;&#x73B0;&#x5B83;&#x7684;&#x76EE;&#x7684;&#xFF0C;&#x5C31;&#x5FC5;&#x987B;&#x6709;&#x4E00;&#x4E2A;&#x4EBA;&#x53BB;&#x601D;&#x8003;&#xFF0C;&#x53BB;&#x6307;&#x6325;&#xFF0C;&#x5E76;&#x4E14;&#x5168;&#x9762;&#x62C5;&#x8D1F;&#x8D77;&#x8D23;&#x4EFB;&#x6765;&#x3002;&#x4F46;&#x662F;&#x88AB;&#x9886;&#x5BFC;&#x7684;&#x4EBA;&#x4E0D;&#x5E94;&#x5F53;&#x53D7;&#x5230;&#x5F3A;&#x8FEB;&#xFF0C;&#x4ED6;&#x4EEC;&#x5FC5;&#x987B;&#x6709;&#x53EF;&#x80FD;&#x6765;&#x9009;&#x62E9;&#x81EA;&#x5DF1;&#x7684;&#x9886;&#x8896;&#x3002;<br>&#x5728;&#x6211;&#x770B;&#x6765;&#xFF0C;&#x5F3A;&#x8FEB;&#x7684;&#x4E13;&#x5236;&#x5236;&#x5EA6;&#x5F88;&#x5FEB;&#x5C31;&#x4F1A;&#x8150;&#x5316;&#x5815;&#x843D;&#x3002;&#x56E0;&#x4E3A;&#x66B4;&#x529B;&#x6240;&#x62DB;&#x5F15;&#x6765;&#x7684;&#x603B;&#x662F;&#x4E00;&#x4E9B;&#x54C1;&#x5FB7;&#x4F4E;&#x52A3;&#x7684;&#x4EBA;&#xFF0C;&#x800C;&#x4E14;&#x6211;&#x76F8;&#x4FE1;&#xFF0C;&#x5929;&#x624D;&#x7684;&#x66B4;&#x541B;&#x603B;&#x662F;&#x7531;&#x65E0;&#x8D56;&#x6765;&#x7EE7;&#x627F;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x6761;&#x5343;&#x53E4;&#x4E0D;&#x6613;&#x7684;&#x89C4;&#x5F8B;&#x3002;&#x5728;&#x4EBA;&#x751F;&#x7684;&#x4E30;&#x5BCC;&#x591A;&#x5F69;&#x7684;&#x8868;&#x6F14;&#x4E2D;&#xFF0C;&#x6211;&#x89C9;&#x5F97;&#x771F;&#x6B63;&#x53EF;&#x8D35;&#x7684;&#xFF0C;&#x4E0D;&#x662F;&#x653F;&#x6CBB;&#x4E0A;&#x7684;&#x56FD;&#x5BB6;&#xFF0C;&#x800C;&#x662F;&#x6709;&#x521B;&#x9020;&#x6027;&#x7684;&#xFF0C;&#x6709;&#x611F;&#x60C5;&#x7684;&#x4E2A;&#x4EBA;&#xFF0C;&#x662F;&#x4EBA;&#x683C;&#xFF1B;&#x53EA;&#x6709;&#x4E2A;&#x4EBA;&#x624D;&#x80FD;&#x521B;&#x9020;&#x51FA;&#x9AD8;&#x5C1A;&#x7684;&#x548C;&#x5353;&#x8D8A;&#x7684;&#x4E1C;&#x897F;&#xFF0C;&#x800C;&#x7FA4;&#x4F17;&#x672C;&#x8EAB;&#x5728;&#x601D;&#x60F3;&#x4E0A;&#x603B;&#x662F;&#x8FDF;&#x949D;&#x7684;&#xFF0C;&#x5728;&#x611F;&#x89C9;&#x4E0A;&#x4E5F;&#x603B;&#x662F;&#x8FDF;&#x949D;&#x7684;&#x3002;&#x201D;<br><br>&#x5BF9;&#x4E8E;&#x6218;&#x4E89;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x8BF4;&#xFF1A;<br>&#x201C;&#x6211;&#x60F3;&#x8D77;&#x4E86;&#x7FA4;&#x4F17;&#x751F;&#x6D3B;&#x4E2D;&#x6700;&#x574F;&#x7684;&#x4E00;&#x79CD;&#x8868;&#x73B0;&#xFF0C;&#x90A3;&#x5C31;&#x662F;&#x4F7F;&#x6211;&#x538C;&#x6076;&#x7684;&#x519B;&#x4E8B;&#x5236;&#x5EA6;&#x3002;&#x4E00;&#x4E2A;&#x4EBA;&#x80FD;&#x591F;&#x6D0B;&#x6D0B;&#x5F97;&#x610F;&#x5730;&#x968F;&#x7740;&#x519B;&#x4E50;&#x961F;&#x5728;&#x56DB;&#x5217;&#x7EB5;&#x961F;&#x91CC;&#x884C;&#x8FDB;&#xFF0C;&#x5355;&#x51ED;&#x8FD9;&#x4E00;&#x70B9;&#x5C31;&#x8DB3;&#x4EE5;&#x4F7F;&#x6211;&#x5BF9;&#x4ED6;&#x8F7B;&#x89C6;&#x3002;&#x4ED6;&#x6240;&#x4EE5;&#x957F;&#x4E86;&#x4E00;&#x4E2A;&#x5927;&#x8111;&#xFF0C;&#x53EA;&#x662F;&#x51FA;&#x4E8E;&#x8BEF;&#x4F1A;&#xFF1B;&#x5355;&#x5355;&#x4E00;&#x6839;&#x810A;&#x9AD3;&#x5C31;&#x53EF;&#x6EE1;&#x8DB3;&#x4ED6;&#x7684;&#x5168;&#x90E8;&#x9700;&#x8981;&#x4E86;&#x3002;&#x6587;&#x660E;&#x56FD;&#x5BB6;&#x7684;&#x8FD9;&#x79CD;&#x7F6A;&#x6076;&#x7684;&#x6E0A;&#x85AE;&#xFF0C;&#x5E94;&#x5F53;&#x5C3D;&#x5FEB;&#x52A0;&#x4EE5;&#x6D88;&#x706D;&#x3002;<br>&#x7531;&#x547D;&#x4EE4;&#x800C;&#x4EA7;&#x751F;&#x7684;&#x52C7;&#x6562;&#x884C;&#x4E3A;&#xFF0C;&#x6BEB;&#x65E0;&#x610F;&#x4E49;&#x7684;&#x66B4;&#x884C;&#xFF0C;&#x4EE5;&#x53CA;&#x5728;&#x7231;&#x56FD;&#x4E3B;&#x4E49;&#x540D;&#x4E49;&#x4E0B;&#x4E00;&#x5207;&#x53EF;&#x6076;&#x7684;&#x80E1;&#x95F9;&#xFF0C;&#x6240;&#x6709;&#x8FD9;&#x4E9B;&#x90FD;&#x4F7F;&#x6211;&#x6DF1;&#x6076;&#x75DB;&#x7EDD;&#xFF0C;&#x5728;&#x6211;&#x770B;&#x6765;&#xFF0C;&#x6218;&#x4E89;&#x662F;&#x591A;&#x4E48;&#x5351;&#x9119;&#x3001;&#x4E0B;&#x6D41;&#xFF01;&#x6211;&#x5B81;&#x613F;&#x88AB;&#x5343;&#x5200;&#x4E07;&#x5250;&#xFF0C;&#x4E5F;&#x4E0D;&#x613F;&#x53C2;&#x9884;&#x8FD9;&#x79CD;&#x53EF;&#x618E;&#x7684;&#x52FE;&#x5F53;&#x3002;&#x5C3D;&#x7BA1;&#x5982;&#x6B64;&#xFF0C;&#x6211;&#x5BF9;&#x4EBA;&#x7C7B;&#x7684;&#x8BC4;&#x4EF7;&#x8FD8;&#x662F;&#x5341;&#x5206;&#x9AD8;&#x7684;&#xFF0C;&#x6211;&#x76F8;&#x4FE1;&#xFF0C;&#x8981;&#x662F;&#x4EBA;&#x6C11;&#x7684;&#x5065;&#x5EB7;&#x611F;&#x60C5;&#x6CA1;&#x6709;&#x88AB;&#x90A3;&#x4E9B;&#x901A;&#x8FC7;&#x5B66;&#x6821;&#x548C;&#x62A5;&#x7EB8;&#x800C;&#x8D77;&#x4F5C;&#x7528;&#x7684;&#x5546;&#x4E1A;&#x5229;&#x76CA;&#x548C;&#x653F;&#x6CBB;&#x5229;&#x76CA;&#x84C4;&#x610F;&#x8FDB;&#x884C;&#x8D25;&#x574F;&#xFF0C;&#x90A3;&#x672B;&#x6218;&#x4E89;&#x8FD9;&#x4E2A;&#x5996;&#x9B54;&#x65E9;&#x5C31;&#x8BE5;&#x7EDD;&#x8FF9;&#x4E86;&#x3002;&#x201D;<br><br>&#x5BF9;&#x4E8E;&#x5B97;&#x6559;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x8BF4;&#xFF1A;<br>&#x201C;&#x6211;&#x4EEC;&#x6240;&#x80FD;&#x6709;&#x7684;&#x6700;&#x7F8E;&#x597D;&#x7684;&#x7ECF;&#x9A8C;&#x662F;&#x5965;&#x79D8;&#x7684;&#x7ECF;&#x9A8C;&#x3002;&#x5B83;&#x662F;&#x575A;&#x5B88;&#x5728;&#x771F;&#x6B63;&#x827A;&#x672F;&#x548C;&#x771F;&#x6B63;&#x79D1;&#x5B66;&#x53D1;&#x6E90;&#x5730;&#x4E0A;&#x7684;&#x57FA;&#x672C;&#x611F;&#x60C5;&#x3002;&#x8C01;&#x8981;&#x662F;&#x4F53;&#x9A8C;&#x4E0D;&#x5230;&#x5B83;&#xFF0C;&#x8C01;&#x8981;&#x662F;&#x4E0D;&#x518D;&#x6709;&#x597D;&#x5947;&#x5FC3;&#x4E5F;&#x4E0D;&#x518D;&#x6709;&#x60CA;&#x8BB6;&#x7684;&#x611F;&#x89C9;&#xFF0C;&#x4ED6;&#x5C31;&#x65E0;&#x5F02;&#x4E8E;&#x884C;&#x5C38;&#x8D70;&#x8089;&#xFF0C;&#x4ED6;&#x7684;&#x773C;&#x775B;&#x662F;&#x8FF7;&#x7CCA;&#x4E0D;&#x6E05;&#x7684;&#x3002;&#x5C31;&#x662F;&#x8FD9;&#x6837;&#x5965;&#x79D8;&#x7684;&#x7ECF;&#x9A8C;&#x2014;&#x2014;&#x867D;&#x7136;&#x63BA;&#x6742;&#x7740;&#x6050;&#x6016;&#x2014;&#x2014;&#x4EA7;&#x751F;&#x4E86;&#x5B97;&#x6559;&#x3002;&#x6211;&#x4EEC;&#x8BA4;&#x8BC6;&#x5230;&#x6709;&#x67D0;&#x79CD;&#x4E3A;&#x6211;&#x4EEC;&#x6240;&#x4E0D;&#x80FD;&#x6D1E;&#x5BDF;&#x7684;&#x4E1C;&#x897F;&#x5B58;&#x5728;&#xFF0C;&#x611F;&#x89C9;&#x5230;&#x90A3;&#x79CD;&#x53EA;&#x80FD;&#x4EE5;&#x5176;&#x6700;&#x539F;&#x59CB;&#x7684;&#x5F62;&#x5F0F;&#x4E3A;&#x6211;&#x4EEC;&#x611F;&#x53D7;&#x5230;&#x7684;&#x6700;&#x6DF1;&#x5965;&#x7684;&#x7406;&#x6027;&#x548C;&#x6700;&#x707F;&#x70C2;&#x7684;&#x7F8E;&#x2014;&#x2014;&#x6B63;&#x662F;&#x8FD9;&#x79CD;&#x8BA4;&#x8BC6;&#x548C;&#x8FD9;&#x79CD;&#x60C5;&#x611F;&#x6784;&#x6210;&#x4E86;&#x771F;&#x6B63;&#x7684;&#x5B97;&#x6559;&#x611F;&#x60C5;&#xFF1B;&#x5728;&#x8FD9;&#x4E2A;&#x610F;&#x4E49;&#x4E0A;&#xFF0C;&#x800C;&#x4E14;&#x4E5F;&#x53EA;&#x662F;&#x5728;&#x8FD9;&#x4E2A;&#x610F;&#x4E49;&#x4E0A;&#xFF0C;&#x6211;&#x624D;&#x662F;&#x4E00;&#x4E2A;&#x5177;&#x6709;&#x6DF1;&#x631A;&#x7684;&#x5B97;&#x6559;&#x611F;&#x60C5;&#x7684;&#x4EBA;&#x3002;<br>&#x6211;&#x65E0;&#x6CD5;&#x60F3;&#x8C61;&#x4E00;&#x4E2A;&#x4F1A;&#x5BF9;&#x81EA;&#x5DF1;&#x7684;&#x521B;&#x9020;&#x7269;&#x52A0;&#x4EE5;&#x8D4F;&#x7F5A;&#x7684;&#x4E0A;&#x5E1D;&#xFF0C;&#x4E5F;&#x65E0;&#x6CD5;&#x60F3;&#x8C61;&#x5B83;&#x4F1A;&#x6709;&#x50CF;&#x5728;&#x6211;&#x4EEC;&#x81EA;&#x5DF1;&#x8EAB;&#x4E0A;&#x6240;&#x4F53;&#x9A8C;&#x5230;&#x7684;&#x90A3;&#x6837;&#x4E00;&#x79CD;&#x610F;&#x5FD7;&#x3002;&#x6211;&#x4E0D;&#x80FD;&#x4E5F;&#x4E0D;&#x613F;&#x53BB;&#x60F3;&#x8C61;&#x4E00;&#x4E2A;&#x4EBA;&#x5728;&#x8089;&#x4F53;&#x6B7B;&#x4EA1;&#x4EE5;&#x540E;&#x8FD8;&#x4F1A;&#x7EE7;&#x7EED;&#x6D3B;&#x7740;&#xFF1B;&#x8BA9;&#x90A3;&#x4E9B;&#x8106;&#x5F31;&#x7684;&#x7075;&#x9B42;&#xFF0C;&#x7531;&#x4E8E;&#x6050;&#x60E7;&#x6216;&#x8005;&#x7531;&#x4E8E;&#x53EF;&#x7B11;&#x7684;&#x552F;&#x6211;&#x8BBA;&#xFF0C;&#x53BB;&#x62FF;&#x8FD9;&#x79CD;&#x601D;&#x60F3;&#x5F53;&#x5B9D;&#x8D1D;&#x5427;&#xFF01;&#x6211;&#x81EA;&#x5DF1;&#x53EA;&#x6C42;&#x6EE1;&#x8DB3;&#x4E8E;&#x751F;&#x547D;&#x6C38;&#x6052;&#x7684;&#x5965;&#x79D8;&#xFF0C;&#x6EE1;&#x8DB3;&#x4E8E;&#x89C9;&#x5BDF;&#x73B0;&#x5B58;&#x4E16;&#x754C;&#x7684;&#x795E;&#x5947;&#x7684;&#x7ED3;&#x6784;&#xFF0C;&#x7AA5;&#x89C1;&#x5B83;&#x7684;&#x4E00;&#x9CDE;&#x534A;&#x722A;&#xFF0C;&#x5E76;&#x4E14;&#x4EE5;&#x8BDA;&#x631A;&#x7684;&#x52AA;&#x529B;&#x53BB;&#x9886;&#x609F;&#x5728;&#x81EA;&#x7136;&#x754C;&#x4E2D;&#x663E;&#x793A;&#x51FA;&#x6765;&#x7684;&#x90A3;&#x4E2A;&#x7406;&#x6027;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x5373;&#x4F7F;&#x53EA;&#x662F;&#x5176;&#x6781;&#x5C0F;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x6211;&#x4E5F;&#x5C31;&#x5FC3;&#x6EE1;&#x610F;&#x8DB3;&#x4E86;&#x3002;&#x201D;&#x201C;&#x4EBA;&#x7C7B;&#x7684;&#x7CBE;&#x795E;&#x6108;&#x5411;&#x524D;&#x8FDB;&#x5316;&#xFF0C;&#x5C31;&#x8D8A;&#x662F;&#x53EF;&#x4EE5;&#x80AF;&#x5B9A;&#x7684;&#x8BF4;&#xFF0C;&#x901A;&#x5411;&#x771F;&#x6B63;&#x5B97;&#x6559;&#x611F;&#x60C5;&#x7684;&#x9053;&#x8DEF;&#xFF0C;&#x4E0D;&#x662F;&#x5BF9;&#x6B7B;&#x4EA1;&#x7684;&#x6050;&#x60E7;&#xFF0C;&#x4E5F;&#x4E0D;&#x662F;&#x76F2;&#x76EE;&#x5D07;&#x62DC;&#x4FE1;&#x4EF0;&#xFF0C;&#x800C;&#x662F;&#x5BF9;&#x7406;&#x6027;&#x77E5;&#x8BC6;&#x7684;&#x8FFD;&#x6C42;&#xFF0C;&#x5BF9;&#x5B87;&#x5B99;&#x65E0;&#x9650;&#x4F1F;&#x5927;&#x610F;&#x5FD7;&#x7684;&#x8C26;&#x5351;&#x548C;&#x5D07;&#x656C;&#x3002;&#x201D;<br><br>&#x201C;&#x4EBA;&#x662F;&#x6211;&#x4EEC;&#x79F0;&#x4E4B;&#x4E3A;&#x5B87;&#x5B99;&#x7684;&#x7EDF;&#x4E00;&#x6574;&#x4F53;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x5728;&#x65F6;&#x95F4;&#x548C;&#x7A7A;&#x95F4;&#x4E0A;&#x90FD;&#x6709;&#x9650;&#x7684;&#x4E00;&#x90E8;&#x5206;&#x3002;&#x5BF9;&#x81EA;&#x6211;&#x3001;&#x601D;&#x7EF4;&#x548C;&#x611F;&#x60C5;&#x7684;&#x4F53;&#x9A8C;&#x90FD;&#x4E0E;&#x4E16;&#x754C;&#x7684;&#x5176;&#x4ED6;&#x90E8;&#x5206;&#x5206;&#x5272;&#x5F00;&#x6765;&#x3002;&#x8FD9;&#x662F;&#x4E00;&#x79CD;&#x610F;&#x8BC6;&#x7684;&#x89C6;&#x89C9;&#x9519;&#x89C9;&#x3002;&#x8FD9;&#x79CD;&#x9519;&#x89C9;&#x6709;&#x5982;&#x4E00;&#x79CD;&#x7262;&#x7B3C;&#xFF0C;&#x4F7F;&#x6211;&#x4EEC;&#x5C40;&#x9650;&#x4E8E;&#x4E2A;&#x4EBA;&#x7684;&#x6B32;&#x671B;&#xFF0C;&#x53EA;&#x5BF9;&#x548C;&#x6211;&#x4EEC;&#x6700;&#x4EB2;&#x8FD1;&#x7684;&#x4EBA;&#x624D;&#x6000;&#x6709;&#x6E29;&#x60C5;&#x3002;&#x6211;&#x4EEC;&#x7684;&#x4EFB;&#x52A1;&#x5E94;&#x662F;&#x6269;&#x5927;&#x540C;&#x60C5;&#x5FC3;&#xFF0C;&#x53BB;&#x62E5;&#x62B1;&#x6240;&#x6709;&#x7684;&#x751F;&#x547D;&#x548C;&#x81EA;&#x7136;&#x754C;&#x4E2D;&#x7F8E;&#x597D;&#x7684;&#x4E00;&#x5207;&#xFF0C;&#x628A;&#x81EA;&#x5DF1;&#x4ECE;&#x8FD9;&#x4E2A;&#x7262;&#x7B3C;&#x4E2D;&#x89E3;&#x653E;&#x51FA;&#x6765;&#x3002;&#x201D;&#x2014;&#x2014;&#x963F;&#x5C14;&#x4F2F;&#x7279;&#xB7;&#x7231;&#x56E0;&#x65AF;&#x5766;<br><br>&#x4ECE;&#x89E3;&#x6790;&#x7269;&#x8D28;&#x5230;&#x89E3;&#x8131;&#x7269;&#x8D28;&#xFF0C;&#x7231;&#x56E0;&#x65AF;&#x5766;&#x770B;&#x7834;&#x4E86;&#x7269;&#x8D28;&#x5C0F;&#x4E11;&#x7684;&#x628A;&#x620F;&#xFF0C;&#x4E5F;&#x770B;&#x6E05;&#x4E86;&#x5B87;&#x5B99;&#x4EBA;&#x751F;&#x7684;&#x771F;&#x76F8;&#xFF0C;&#x4ECE;&#x5B87;&#x5B99;&#x548C;&#x8C10;&#x7684;&#x6B21;&#x5E8F;&#x4E2D;&#xFF0C;&#x4ECE;&#x661F;&#x6C49;&#x707F;&#x70C2;&#x7684;&#x94F6;&#x6CB3;&#x8FB9;&#xFF0C;&#x4ED6;&#x770B;&#x5230;&#x4E86;&#x4E00;&#x4E2A;&#x4F1F;&#x5927;&#x7684;&#x610F;&#x5FD7;&#x548C;&#x529B;&#x91CF;&#xFF0C;&#x5FC3;&#x60A6;&#x8BDA;&#x670D;&#x4E8E;&#x5927;&#x5B87;&#x5143;&#x771F;&#x975E;&#x51E1;&#x7684;&#x521B;&#x9020;&#x548C;&#x667A;&#x6167;&#xFF0C;&#x8D70;&#x51FA;&#x81EA;&#x6211;&#xFF0C;&#x5B8C;&#x6210;&#x4E86;&#x4E00;&#x4E2A;&#x667A;&#x8005;&#x5BF9;&#x4E8E;&#x751F;&#x547D;&#x548C;&#x4E07;&#x7269;&#x7684;&#x8D85;&#x8D8A;&#xFF0C;&#x6EF4;&#x6C34;&#x5165;&#x6D77;&#xFF0C;&#x7EC8;&#x5F52;&#x672C;&#x6E90;&#x3002;&#x4ED6;&#x662F;&#x5B87;&#x5B99;&#x771F;&#x7406;&#x7684;&#x63ED;&#x793A;&#x8005;&#xFF0C;&#x4E5F;&#x662F;&#x8FD4;&#x6734;&#x5F52;&#x771F;&#x7684;&#x8DF5;&#x884C;&#x8005;&#xFF0C;&#x5728;&#x4ED6;&#x7684;&#x80CC;&#x5F71;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x770B;&#x5230;&#x4E86;&#x56DE;&#x5BB6;&#x7684;&#x8DEF;&#x6807;&#x3002;&#x3000;<br>&#x201C;&#x5BF9;&#x4E8E;&#x4E00;&#x4E2A;&#x4EBA;&#x81EA;&#x8EAB;&#x7684;&#x5B58;&#x5728;&#xFF0C;&#x4F55;&#x8005;&#x662F;&#x6709;&#x610F;&#x4E49;&#x7684;&#xFF0C;&#x4ED6;&#x81EA;&#x5DF1;&#x5E76;&#x4E0D;&#x77E5;&#x6653;&#xFF0C;&#x5E76;&#x4E14;&#xFF0C;&#x8FD9;&#x4E00;&#x70B9;&#x80AF;&#x5B9A;&#x4E5F;&#x4E0D;&#x5E94;&#x8BE5;&#x6253;&#x6270;&#x5176;&#x4ED6;&#x4EBA;&#x3002;<br>&#x4E00;&#x6761;&#x9C7C;&#x80FD;&#x5BF9;&#x5B83;&#x7EC8;&#x751F;&#x7545;&#x6E38;&#x5176;&#x4E2D;&#x7684;&#x6C34;&#x77E5;&#x9053;&#x4E9B;&#x4EC0;&#x4E48;&#xFF1F;&#x3000;&#x3000;&#x2026;&#x2026;&#x3000;<br><br>&#x6211;&#x5B64;&#x5BC2;&#x5730;&#x751F;&#x6D3B;&#x7740;&#xFF0C;&#x5E74;&#x8F7B;&#x65F6;&#x75DB;&#x82E6;&#x4E07;&#x5206;&#xFF0C;&#x800C;&#x5728;&#x6210;&#x719F;&#x4E4B;&#x5E74;&#x91CC;&#x5374;&#x7518;&#x4E4B;&#x5982;&#x9974;&#x3002;&#x201D;<br><br>&#x201C;&#x7269;&#x8D28;&#x3001;&#x7A7A;&#x95F4;&#x548C;&#x7269;&#x8D28;&#xFF0C;&#x662F;&#x4EBA;&#x7C7B;&#x8BA4;&#x8BC6;&#x7684;&#x9519;&#x89C9;&#x3002;&#x201D;&#x201C;&#x73B0;&#x5B9E;&#x5373;&#x5E7B;&#x8C61;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x6BD4;&#x8F83;&#x7A33;&#x5B9A;&#x7F62;&#x4E86;&#x3002;&#x201D;<br><br>&#x201C;&#x8D70;&#x51FA;&#x72ED;&#x9698;&#x7684;&#x81EA;&#x6211;&#xFF0C;&#x751F;&#x6D3B;&#x624D;&#x771F;&#x6B63;&#x5F00;&#x59CB;&#x3002;&#x201D;&#x3000;&#x2014;&#x2014;&#x963F;&#x5C14;&#x4F2F;&#x7279;&#xB7;&#x7231;&#x56E0;&#x65AF;&#x5766;</p>]]></content:encoded></item><item><title><![CDATA[Running Javascript in .net core]]></title><description><![CDATA[<p>If you are looking for a solution of running code library cross environment, you probly think javascript, we need share code/logic through environment, and coding one and once only.</p><p>There are 2 ways of excution javascript</p><!--kg-card-begin: markdown--><ul>
<li>Headless browser - Internet explorer without UI, you can run js in simulation</li></ul>]]></description><link>https://blog.ourdark.org/running-javascript-in-net-core/</link><guid isPermaLink="false">62301eab64b2890001dc409c</guid><category><![CDATA[Technical]]></category><dc:creator><![CDATA[Ourdark]]></dc:creator><pubDate>Fri, 22 Jan 2021 07:11:32 GMT</pubDate><content:encoded><![CDATA[<p>If you are looking for a solution of running code library cross environment, you probly think javascript, we need share code/logic through environment, and coding one and once only.</p><p>There are 2 ways of excution javascript</p><!--kg-card-begin: markdown--><ul>
<li>Headless browser - Internet explorer without UI, you can run js in simulation envireonment.</li>
<li>Js Engine/Framework - Excute javascript with engine support</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><p>The headless browser:</p>
<ul>
<li><a href="http://sourceforge.net/projects/webkitdotnet/%5D">WebKit.Net</a>(free)</li>
<li><a href="http://awesomium.com/">Awesomium</a> It is based on Chrome/WebKit and works like a charm. There is a free license available but also a commercial one and if need be you can buy the source code</li>
<li><a href="http://html-agility-pack.net/?z=codeplex">HTML Agility Pack</a> (free) (An HTML Parser library, NOT a headless browser)<br>
This helps with extracting information from HTML etc. and might be useful in your case (possibly in combination with HttpWebRequest)</li>
<li><a href="http://phantomjs.org/">PhantomJS</a> - full featured headless web browser. Often used in pair with Selenium which allows you to access the browser from .NET application.</li>
<li><a href="https://github.com/RusKnyaz/Optimus">Optimus</a> - lightweight headless web browser. It&apos;s in beta but it is sufficient for some cases.</li>
</ul>
<!--kg-card-end: markdown--><p>But they ALL dead(2021/1/22), so there is only one way posible.</p><p>The JS Engine</p><!--kg-card-begin: markdown--><ul>
<li><a href="https://www.nuget.org/packages/Microsoft.AspNetCore.NodeServices/5.0.0-preview.4.20257.10">Microsoft.AspNetCore.NodeServices</a> is obsolted, it involve NodeJS run time</li>
<li><a href="https://github.com/microsoft/ClearScript">microsoft/ClearScript</a> ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via V8 and JScript) and VBScript.</li>
<li><a href="https://github.com/chakra-core/ChakraCore">JavaScriptEngineSwitcher.ChakraCore</a> Microsoft will continue to provide security updates for ChakraCore 1.11 until 9th March 2021 but do not intend to support it after that.</li>
</ul>
<!--kg-card-end: markdown--><!--kg-card-begin: markdown--><pre class="language-csharp line-number"><code>// create a script engine
using (var engine = new V8ScriptEngine())
{
    // expose a host type
    engine.AddHostType(&quot;Console&quot;, typeof(Console));
    engine.Execute(&quot;Console.WriteLine(&apos;{0} is an interesting number.&apos;, Math.PI)&quot;);
    // expose a host object
    engine.AddHostObject(&quot;random&quot;, new Random());
    engine.Execute(&quot;Console.WriteLine(random.NextDouble())&quot;);
    // expose entire assemblies
    engine.AddHostObject(&quot;lib&quot;, new HostTypeCollection(&quot;mscorlib&quot;, &quot;System.Core&quot;));
    engine.Execute(&quot;Console.WriteLine(lib.System.DateTime.Now)&quot;);
    // create a host object from script
    engine.Execute(@&quot;
    birthday = new lib.System.DateTime(2007, 5, 22);
    Console.WriteLine(birthday.ToLongDateString());
    &quot;);
    // use a generic class from script
    engine.Execute(@&quot;
    Dictionary = lib.System.Collections.Generic.Dictionary;
    dict = new Dictionary(lib.System.String, lib.System.Int32);
    dict.Add(&apos;foo&apos;, 123);
    &quot;);
    // call a host method with an output parameter
    engine.AddHostObject(&quot;host&quot;, new HostFunctions());
    engine.Execute(@&quot;
    intVar = host.newVar(lib.System.Int32);
    found = dict.TryGetValue(&apos;foo&apos;, intVar.out);
    Console.WriteLine(&apos;{0} {1}&apos;, found, intVar);
    &quot;);
    // create and populate a host array
    engine.Execute(@&quot;
    numbers = host.newArr(lib.System.Int32, 20);
    for (var i = 0; i &lt; numbers.Length; i++) { numbers[i] = i; }
    Console.WriteLine(lib.System.String.Join(&apos;, &apos;, numbers));
    &quot;);
    // create a script delegate
    engine.Execute(@&quot;
    Filter = lib.System.Func(lib.System.Int32, lib.System.Boolean);
    oddFilter = new Filter(function(value) {
    return (value &amp; 1) ? true : false;
    });
    &quot;);
    // use LINQ from script
    engine.Execute(@&quot;
    oddNumbers = numbers.Where(oddFilter);
    Console.WriteLine(lib.System.String.Join(&apos;, &apos;, oddNumbers));
    &quot;);
    // use a dynamic host object
    engine.Execute(@&quot;
    expando = new lib.System.Dynamic.ExpandoObject();
    expando.foo = 123;
    expando.bar = &apos;qux&apos;;
    delete expando.foo;
    &quot;);
    // call a script function
    engine.Execute(&quot;function print(x) { Console.WriteLine(x); }&quot;);
    engine.Script.print(DateTime.Now.DayOfWeek);
    // examine a script object
    engine.Execute(&quot;person = { name: &apos;Fred&apos;, age: 5 }&quot;);
    Console.WriteLine(engine.Script.person.name);
    // read a JavaScript typed array
    engine.Execute(&quot;values = new Int32Array([1, 2, 3, 4, 5])&quot;);
    var values = (ITypedArray<int>)engine.Script.values;
    Console.WriteLine(string.Join(&quot;, &quot;, values.ToArray()));
}</int></code></pre><!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>