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 / Benchmark_alignas_packed_variables.cpp
Last active January 31, 2023 12:24
Benchmark alignas , packed on variables
//////// demo online: https://quick-bench.com/q/TYcfwD0khRpbE53rn8cRtn7nmvA
#include <vector>
#include <cstddef>
static constexpr auto totalVecSize = 99'999;
struct __attribute__ ((packed)) AAA_packed {
int a;
char b;
float c;
@SC-One
SC-One / CustomProgressBar.qml
Last active March 1, 2023 06:38
simple sample of CustomProgressbar in QML (QtQuick2)
import QtQuick 2.15
Rectangle {
id:rootRect
property int currentValue:0;
property int maxValue:100;
property int minValue:0;
property color colorBar:"#7ec26e";
property alias textBar: barText
@SC-One
SC-One / bash_aliases
Created March 15, 2023 06:31
My favorite aliases in bash (usefull in ubuntu's terminal)
alias gitstart='eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
'
alias copy='xclip -selection clipboard'
# alias bjson='python -m json.tool' # beautify json
bjsonStr(){
echo "$1" | python3 -m json.tool
}
bjsonFile(){
python3 -m json.tool "$1"
@SC-One
SC-One / install_cuda_11_ubuntu_2004.md
Created April 7, 2023 19:42 — forked from ksopyla/install_cuda_11_ubuntu_2004.md
How to install CUDA toolkit 11 at ubuntu 20.04

Step by step instruction how to install CUDA 11 Ubuntu 20.04

NVidia Ubuntu 20.04 repository for CUDA 11

If you need CUDA Tolkit 11 with nvcc, other tools and libraries you can install it from NVIDIA Ubunutu 20.04 repository.

Add Ubuntu 20.04 repository

@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
@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 / 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 / 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 / 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 / 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