Skip to content

Instantly share code, notes, and snippets.

@amir-saniyan
amir-saniyan / File To Header.md
Last active August 23, 2020 17:48
This code converts any file to C++ header file.

File To Header

This code converts any file to C++ header file.

Usage

usage: file_to_header.py [-h] -i INPUT -o OUTPUT -n NAME [-k KEY]

Converts any file to C++ header file.
@amir-saniyan
amir-saniyan / EmbeddingPython.md
Created August 17, 2020 10:04
C++ implementation of "Hello World" embedding Python

Embedding Python

This gist contains C++ implementation of Hello World embedding Python.

HelloWorld.cpp:

#include <cstdlib>
#include <stdexcept>

#include <Python.h>
@amir-saniyan
amir-saniyan / C++ File IO.md
Created July 22, 2020 16:53
C++ helper functions to read and write files.

C++ File I/O

This gist contains C++ helper functions to read and write files.

FileHelper.h:

#include <string>
#include <vector>

Cross-compiling MXNet on Ubuntu for Raspberry Pi

Obtaining the toolchain

$ sudo apt install crossbuild-essential-armhf
$ sudo apt install crossbuild-essential-arm64 

@amir-saniyan
amir-saniyan / EmbedResource.cmake
Last active February 1, 2024 14:17
Pure CMake function to convert any file into C/C++ source code, implemented with only CMake commands.
####################################################################################################
# This function converts any file into C/C++ source code.
# Example:
# - input file: data.dat
# - output file: data.h
# - variable name declared in output file: DATA
# - data length: sizeof(DATA)
# embed_resource("data.dat" "data.h" "DATA")
####################################################################################################
@amir-saniyan
amir-saniyan / Using find_package with ExternalProject in CMake.cmake
Last active March 8, 2025 21:06
This gist shows how to use find_package with ExternalProject and ExternalProject_add in CMake.
# --------------------------------------------------
function (build_external_project target file_name)
set(CMAKELIST_CONTENT "
cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
project(build_external_project)
file(MD5 \"${file_name}\" FILE_HASH)

Ubuntu 22.04 for Deep Learning

In the name of God

This gist contains steps to setup Ubuntu 22.04 for deep learning.


Install Ubuntu 22.04