Skip to content

Instantly share code, notes, and snippets.

@shuihan0555
shuihan0555 / CMakeLists.txt
Created December 4, 2020 02:23 — forked from jlgerber/CMakeLists.txt
cmake - handling executable and library with same name
# Lets say we want to add a library and an executable, both with the same name.
# In this example, it is resman
add_library(resman ${src_cpps} ${src_hpps} )
target_link_libraries(resman ${Boost_LIBRARIES} ${LIBYAML} ${LIBFMT})
#
# Add resman executable
#
# We call the executable resman-bin
add_executable(resman-bin main.cpp )
@shuihan0555
shuihan0555 / tcpip.md
Created September 19, 2019 20:55 — forked from ilmoeuro/tcpip.md
TCP/IP applications by example

TCP/IP applications by example

In this tutorial we'll implement some simple TCP/IP applications with ncat, bash and some other standard UNIX tools. The principles learned here can be used to implement networking applications in other languages.

The $ or # in front of command line examples denotes the system prompt. Do not type it

@shuihan0555
shuihan0555 / curl_example.cpp
Created May 22, 2018 02:53 — forked from alghanmi/curl_example.cpp
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
@shuihan0555
shuihan0555 / main.cpp
Created October 26, 2017 09:56 — forked from roxlu/main.cpp
Testing with libuv, openssl, memory bios, non blocking sockets: how to handle ssl and application data (?)
#include <iostream>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <uv.h>
#include <vector>
#include <iterator>
#include <algorithm>
@shuihan0555
shuihan0555 / README.md
Created June 7, 2017 01:40 — forked from Jxck/README.md
libuv TCP server/client sample

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client