Skip to content

Instantly share code, notes, and snippets.

View bsergean's full-sized avatar
👻

Benjamin Sergeant bsergean

👻
View GitHub Profile
@bsergean
bsergean / CMakeLists.txt
Last active January 22, 2023 18:00
Building an iree simple runtime program, using cmake fetchcontent to download iree.
# Copy pasted with few changes (see at the bottom) on January the 23th, 2023
# From https://github.com/iree-org/iree-samples/blob/main/cpp/CMakeLists.txt
#
# Copyright 2022 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.21...3.23)
@bsergean
bsergean / CMakeLists.txt
Created January 27, 2022 17:47
Testing consuming libdeflate CMake with FetchContent
project(my_exe)
cmake_minimum_required(VERSION 3.20)
include(FetchContent)
FetchContent_Declare(libdeflate
GIT_REPOSITORY "https://github.com/SpaceIm/libdeflate"
GIT_TAG "cmakelists" # Or an explicit tag
GIT_SHALLOW 1)
@bsergean
bsergean / CMakeLists.txt
Created January 24, 2022 20:04 — forked from sifangli/CMakeLists.txt
Test jemalloc memory profile
cmake_minimum_required(VERSION 3.17)
project(MyCppTest)
set(CMAKE_CXX_STANDARD 20)
include_directories(/tmp/jemalloc/include)
link_directories(/tmp/jemalloc/lib)
add_library(jemalloc SHARED IMPORTED)
@bsergean
bsergean / CMakeLists.txt
Last active June 27, 2021 06:01
CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
include(FetchContent)
FetchContent_Declare(llhttp
URL "https://github.com/bsergean/llhttp/releases/download/v6.0.3/llhttp-release-v6.0.3.tar.gz")
FetchContent_MakeAvailable(llhttp)
project(llhttp_example_program)
This file has been truncated, but you can view the full file.
Type Ctrl-D to exit prompt...
Connecting to url: wss://demo.websocket.me/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm&notify_self
ssl_tls.c:5793: |2| 0x7fbaae808258: => handshake
ssl_cli.c:4416: |2| 0x7fbaae808258: client state: 0
ssl_msg.c:2215: |2| 0x7fbaae808258: => flush output
ssl_msg.c:2227: |2| 0x7fbaae808258: <= flush output
ssl_cli.c:4416: |2| 0x7fbaae808258: client state: 1
ssl_msg.c:2215: |2| 0x7fbaae808258: => flush output
ssl_msg.c:2227: |2| 0x7fbaae808258: <= flush output
ssl_cli.c:0992: |2| 0x7fbaae808258: => write client hello
@bsergean
bsergean / libuv_dns_example.c
Last active January 17, 2021 19:12
libuv dns example
//
// Adapted from https://github.com/Elzair/libuv-examples/blob/master/dns/dns.c
// to also loop through all results.
//
#include <stdio.h>
#include <stdlib.h>
#include <uv.h>
#include <string>
@bsergean
bsergean / mk_sentry_cli_deb.sh
Created December 8, 2020 06:24
Making a debian package for sentry-cli, using ruby fpm
#!/usr/env/bin bash
#
# For fpm:
# apk add ruby
# apk add ruby-dev
# apk add ruby-etc
# apk add tar
#
/*
*
# each * represents a count of 40. total 5823
zlib [ 2775] *********************************************************************
zlib-ng [ 1808] *********************************************
libdeflate [ 1240] *******************************
*
$ clang++ -DHAVE_LIBDEFLATE=1 -O3 --std=c++14 --stdlib=libc++ gzip.cpp /usr/local/lib/libdeflate.a && ./a.out ~/Desktop/example_data.bin
median runtime to compress file: 1240
@bsergean
bsergean / gist:b3915a7316f6a199313e58ec9dcc2e7b
Created September 9, 2020 21:01
Run a websocket echo server locally with docker (problem with Ctrl-C)
docker run -p8008:8008 -it bsergean/ws:10.3.4 echo_server --host 0.0.0.0
@bsergean
bsergean / ConsoleApplication5.cpp
Last active August 6, 2020 11:25
ixwebsocket_issue_227_repro
// ConsoleApplication5.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include "webSockServer.h"
int main()
{
std::cout << "Server Starting up!\n";
CWebSocketsServer server(nullptr);
server.initialize();