Skip to content

Instantly share code, notes, and snippets.

View SC-One's full-sized avatar
✌️
GoingOn

Heydar Mahmoodi SC-One

✌️
GoingOn
View GitHub Profile
@SC-One
SC-One / TheVisualComputer_springer.sty
Created September 17, 2025 09:47
style file (it's not complete, but it's ok for starting) for journal The Visual Computer (Springer)
\RequirePackage{hyperref}
\ProvidesPackage{visualcomputer}[2025/09/15 Helper for The Visual Computer submissions]
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{mathptmx}
\RequirePackage[a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
@SC-One
SC-One / CTU.md
Last active July 9, 2024 12:57
Common Terminal Utilities

common utilities for terminal deploy and develope applications


  • finding files that is depend on LibraryA in mac in otool (recursive in a rootFolder)

    find rootFolder -type f -perm +111 -exec sh -c 'otool -L "$1" | grep -q LibraryA && echo "$1"' _ {} \;

  • signing an application (completely) after releasing

codesign --deep --force --verify --verbose --sign "Developer ID Application: Fname LName (KeyChainID)" application.app

@SC-One
SC-One / CMakeLists.txt
Created May 31, 2024 21:06 — forked from baiwfg2/CMakeLists.txt
How to use add_custom_target and add_custom_command correctly in cmake
# References:
# https://cmake.org/cmake/help/latest/command/add_custom_target.html
# https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/
# https://gist.github.com/socantre/7ee63133a0a3a08f3990
# https://stackoverflow.com/questions/24163778/how-to-add-custom-target-that-depends-on-make-install
# https://stackoverflow.com/questions/30719275/add-custom-command-is-not-generating-a-target
# https://stackoverflow.com/questions/26024235/how-to-call-a-cmake-function-from-add-custom-target-command
# https://blog.csdn.net/gubenpeiyuan/article/details/51096777
cmake_minimum_required(VERSION 3.10)
@SC-One
SC-One / QtMinorVersionsCheck.cmake
Last active February 19, 2024 22:49
CMake code for checking qt major minor patch version
# First way todays:
find_package(QT 5.15.2 NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick LinguistTools)
############################################################################################
# Alternative way:
if (Qt5Core_FOUND)
if (Qt5Core_VERSION VERSION_LESS 5.15.2)
message(FATAL_ERROR "Minimum supported Qt5 version is 5.15.2! current version: " ${Qt5Core_VERSION})
endif()
@SC-One
SC-One / generate-icns.sh
Created December 18, 2023 16:09 — forked from ahmed-musallam/generate-icns.sh
A Shell script to generate .ico and .icns files (mac/windows app icons) from a single PNG
# Required deps:
# imagemagick: https://imagemagick.org/script/download.php
# name of your master icon, must be at least 512X512
PNG_MASTER="icon-large.png"
ICONSET_FOLDER="AppIcon.iconset"
sizes=(
16x16
32x32
@SC-One
SC-One / TimeProfiler.hpp
Last active January 17, 2025 06:13
time measurement c++ (profiling out)
#ifndef TIMER_PROFILER_HPP
#define TIMER_PROFILER_HPP
#include <chrono>
#include <string>
namespace TimeProfilerHelper {
template <typename T>
struct ChronoName{
static_assert(std::is_same_v<T, void>, "Unsupported chrono type!");
};
@SC-One
SC-One / CircularBuffer.qml
Last active October 2, 2023 18:53
implementation of CircularBuffer in qml
import QtQuick 2.0
QtObject {
property int maximumSize: 10
property var buffer: []
property int head: 0
property int size: 0
function initialize() {
buffer = [];
@SC-One
SC-One / 01-mac-profiling.md
Created September 4, 2023 09:41 — forked from loderunner/01-mac-profiling.md
Profiling an application in Mac OS X

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity:

@SC-One
SC-One / FooTableModel.h
Created May 17, 2023 14:02
How subclassing QAbstractTableModel in qt
class FooTableModel : public QAbstractTableModel {
Q_OBJECT
public:
FooTableModel(QObject *parent = nullptr);
// readonly tables
Qt::ItemFlags flags(const QModelIndex &index)
const override; // editable can return: Qt::ItemIsEditable
QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const override;
@SC-One
SC-One / cuda_11.7_installation_on_Ubuntu_22.04
Created April 8, 2023 08:18 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.7 and cuDNN 8.5 installation on Ubuntu 22.04 for PyTorch 1.12.1
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check