Skip to content

Instantly share code, notes, and snippets.

View atifkarim's full-sized avatar
🎯
Focusing

MD Atif Bin Karim atifkarim

🎯
Focusing
View GitHub Profile
@atifkarim
atifkarim / demo.cpp
Created October 19, 2020 14:31
change code on 19 Oct
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo.cpp
//
// (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <cstddef> // NULL
@atifkarim
atifkarim / code.html
Created December 3, 2020 16:24
csv_js
<!DOCTYPE html>
<html>
<head>
<title>Chart using XML Data</title>
<script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<script type="text/javascript">
window.onload = function() {
var dataPoints = [];
// var dataPoints_1 = [];
@atifkarim
atifkarim / error_log
Last active February 21, 2021 11:47
error text of pybind while binding class template consistig virtual function
[ 11%] Building CXX object CMakeFiles/somecode.dir/src/binding.cpp.o
In file included from /media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/pybind11.h:48:0,
from /media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/src/binding.cpp:1:
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h: In instantiation of ‘Class* pybind11::detail::initimpl::construct_or_initialize(Args&& ...) [with Class = declare_class_template_abstarct(pybind11::module&, const string&) [with T = int; pybind11::module = pybind11::module_; std::__cxx11::string = std::__cxx11::basic_string<char>]::PyVirtualClass; Args = {int}; typename std::enable_if<(! std::is_constructible<_Tp, _Args>::value), int>::type <anonymous> = 0]’:
/media/atif/BE0E05910E0543BD/University of Bremen MSc/my_git_repos/pybind_cpp_cmake/lib/pybind11/include/pybind11/detail/init.h:196:68:
@atifkarim
atifkarim / binding.cpp
Last active February 19, 2021 01:03
class template binded with pybind
#include <pybind11/pybind11.h>
#include "class_template_inheritance.h"
namespace py = pybind11;
/**
* Base class
*/
template <typename T = int>
@atifkarim
atifkarim / CMakeLists.txt
Last active February 22, 2021 14:16
class template consisting virtual function binding with pybind
cmake_minimum_required(VERSION 3.10)
project(somecode)
set(LIB_GEN_PATH ${PROJECT_SOURCE_DIR}/scripts CACHE STRING "Where generated library will be placed")
add_subdirectory(lib/pybind11)
include_directories(${PROJECT_SOURCE_DIR}/include)
pybind11_add_module(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/src/binding.cpp)
@atifkarim
atifkarim / CMakeLists.txt
Last active February 22, 2021 09:14
multiple_typename_pybind
cmake_minimum_required(VERSION 3.10)
project(somecode)
set(LIB_GEN_PATH ${PROJECT_SOURCE_DIR}/scripts CACHE STRING "Where generated library will be placed")
add_subdirectory(lib/pybind11)
include_directories(${PROJECT_SOURCE_DIR}/include)
pybind11_add_module(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/src/binding.cpp)
@atifkarim
atifkarim / 1_structure_of_project
Last active March 16, 2021 13:04
bind class template in seperate file using pybind11
pybind_cpp_cmake
-- /include/sample_class_template.h
-- /lib/pybind11
-- /src/binding.cpp
/binding_module_class_template.cpp
/sample_class_template.cpp
CMakeLists.txt
@atifkarim
atifkarim / protobuf-tutorial-mac.md
Created February 1, 2022 21:59 — forked from madelinegannon/protobuf-tutorial-mac.md
Google Protobuf Tutorial for Mac and c++

How to Install and Run Google's Protocol Buffer Basics: C++ Tutorial on Mac

Tested on: macOS High Sierra v10.13.3

1. Install Google Protobuf

Google's official README is here. Follow their instructions to install the special dependencies that mac needs.

The steps I share below are a combination of this gist, this gist, and this answer. The main difference is that I started by manually downloading the latest cpp release from google's release repo. If you start from there, here's what to do next:

  1. First, unzip the file.