Skip to content

Instantly share code, notes, and snippets.

View lixit's full-sized avatar

xitong lixit

View GitHub Profile

Two Linux C/C++ library types 1. Static Library (.a) : become part of application 2. Dynamically linked shared object libraries (.so) : one form but can used in two ways: 1) Dynamically linked at run time 2) Dynamically loaded/unloaded and linked during execution using the dynamic linking loader system functions

Library naming convertions: libraries are typically named with prefix "lib". When linking, the command line reference will not contain the library prefix and suffix example: gcc src.c -lm -lpthread

SSL enhances TCP with confidentiality, data integrity, server authentication, and client authentication.

openssl command [ command_opts ] [ command_args ]

openssl list [ commands | digest-commands | cipher-commands | cipher-algorithms | digest-algorithms | public-key-algorithms]

openssl no-XXX [ arbitrary options ]

1. Symmetric Key Cryptography

1.1 symmetric encryption techniques

  • stream ciphers
  • block ciphers

1.2 block ciphters

  • DES (Data Encryption Standard)
  • 3DES
  • AES (Advanced Encryption Standard)

1.3 Cipher-Block Chaining (CBC)

Install in Ubuntu:

# download: https://www.emqx.io/downloads/broker?osType=Linux
# unzip emqx-ubuntu18.04-v3.2.2.zip && cd emqx
# start emqx
./bin/emqx start
# Check the running status
./bin/emqx_ctl status
# stop emqx
./bin/emqx stop

Build using Make

git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make
# to install
sudo make install

Test

Usage:

cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>

If specify a source directory, it (re)generates a build system in the current working directory
If specify an existing build directory, it regenerates the build system
Or specify source dir and build dir using -S and -B

@lixit
lixit / vsa.md
Last active September 25, 2019 06:45
                +----------+                       增加/管理用户
                |  Manager +-----------------------修改权限------ -----+
                +----------+                                         |
                                                                     |
                                                                     |
                                                                     |
   +------------+     +-------------+    +--------------+            |
   | Controller |     |  Controller |    |  Controller  +-----+      |
   +----+-------+     +----+--------+    ++-------------+     |      |

Chapter 7 Linking

  • satic linking
  • dynamic linking of shared libraries at load time
  • dynamic linking of shared libraries at run time

C preprocessor(cpp)

cpp main.c tmp/main.i
gcc -E main.c
@lixit
lixit / OAuth.md
Last active September 27, 2019 09:46

OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service

is designed for use with HTTP

OAuth defines four roles:

  • resource owner(end user)
  • resource server
  • client
  • authorization server
@lixit
lixit / python.md
Last active October 9, 2019 02:50

Numbers

  • int eg. 2, 4, 20
  • float eg. 5.0, 1.6

Division ( / ) always returns a float. // returns an integer

Strings

('...') or double quotes ("...") with the same result.