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 / 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 / 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 / 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 / AwesomeStruct.cpp
Created November 16, 2022 15:30 — forked from hanzochang/AwesomeStruct.cpp
[UE4(Unreal Engine 4)] Example for parsing json and creating struct instance from parsed json.
#include "ProcedualSpline.h"
#include "AwesomeStruct.h"
FAwesomeStruct FAwesomeStruct::BuildAwesomeStruct(
FVector AwesomeVector,
bool AwesomeBoolean,
float AwesomeFloat,
int32 AwesomeInteger,
FRotator AwesomeRotator
)
@SC-One
SC-One / gist:e55b30df1b85f2ff675bf2e44feae959
Created September 29, 2022 09:11 — forked from royshil/gist:6318407
A CMake Find module for FFMPEG that will tear the HD apart looking for the libs and includes ;)
# - Try to find FFMPEG
# Once done this will define
# FFMPEG_FOUND - System has FFMPEG
# FFMPEG_INCLUDE_DIRS - The FFMPEG include directories
# FFMPEG_LIBRARIES - The libraries needed to use FFMPEG
# FFMPEG_LIBRARY_DIRS - The directory to find FFMPEG libraries
#
# written by Roy Shilkrot 2013 http://www.morethantechnical.com/
#
@SC-One
SC-One / AutomaticPageRefresher.js
Created August 3, 2022 19:03
Automatic refresh window in js (usecase: browser console)
win1 = window.open("https://www.binance.com/en/price/binance-usd")
var windowObject = win1.document
var counter = 0
timer1 = setInterval(function() {
win1.location.href = "https://www.binance.com/en/price/binance-usd"
counter++
console.log("Counter: ", counter)
// if (windowObject < win1.document || windowObject > win1.document) {
// alert("Hi diffrent page")
// }
@SC-One
SC-One / TemplateBaseBenchmark.cpp
Last active April 16, 2022 12:01
Template base benchmark (google)
//https://github.com/google/benchmark/issues/1157
#include <benchmark/benchmark.h>
#include <vector>
#include <future>
#include <numeric>
#include <span>
using NumberType = float;
using ReduceType = double;
@SC-One
SC-One / config.clang-format
Last active March 4, 2022 14:36
Clang-format config file
# Checkout config tool: https://zed0.co.uk/clang-format-configurator/
# Or http://cf.monofraps.net/
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# https://github.com/01org/parameter-framework/blob/master/.clang-format
# Tested on: clang-format version 6.0.1
# Common settings
BasedOnStyle: WebKit
@SC-One
SC-One / TwoFilesInONe.CMAKE
Created February 14, 2022 16:18
add rapidjson from cmake (direct download rapidjson in CMake)
# Download RapidJSON
ExternalProject_Add(
rapidjson
PREFIX "vendor/rapidjson"
GIT_REPOSITORY "https://github.com/Tencent/rapidjson.git"
GIT_TAG f54b0e47a08782a6131cc3d60f94d038fa6e0a51
TIMEOUT 10
CMAKE_ARGS
-DRAPIDJSON_BUILD_TESTS=OFF
-DRAPIDJSON_BUILD_DOC=OFF
@SC-One
SC-One / CollapsedWidget.hpp
Created February 5, 2022 17:44
Collapsed widget in qt with animation
#ifndef COLLAPSED_WIDGET_H
#define COLLAPSED_WIDGET_H
#include <QFrame>
#include <QGridLayout>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QScrollArea>
#include <QToolButton>
#include <QWidget>