Skip to content

Instantly share code, notes, and snippets.

@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 20, 2024 15:02
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

@amir-saniyan
amir-saniyan / Full-Update.md
Last active April 25, 2020 14:02
Full Update Script for Ubuntu (apt packages and python libraries)

Full Update Script for Ubuntu

This script updates Ubuntu packages and python libraries.

full-update.sh:

#!/bin/bash

if [ "$EUID" -ne 0 ]
  then echo "Error: Please run as root."
@amir-saniyan
amir-saniyan / OpenSSL Server Example.md
Last active April 28, 2024 05:17
OpenSSL Server Example

OpenSSL Server Example

This sample code shows how to create an OpenSSL server application.

Compilation

Prerequisites:

$ sudo apt-get install gcc pkg-config libssl-dev openssl