Skip to content

Instantly share code, notes, and snippets.

View amirmasoudabdol's full-sized avatar

Amir Masoud Abdol amirmasoudabdol

View GitHub Profile
@amirmasoudabdol
amirmasoudabdol / bundle.cmake
Last active May 25, 2023 14:12
bundle.cmake
if(is_cmake_bundle_identifier_given
AND is_xcode_bundle_identifier_given
AND NOT existing_cmake_bundle_identifier STREQUAL existing_xcode_bundle_identifier)
message(WARNING
"MACOSX_BUNDLE_GUI_IDENTIFIER and XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "
"are set to different values. You only need to set one of them. "
"Use 'MACOSX_BUNDLE_GUI_IDENTIFIER' for maximum compatibility. ")
endif()
if(NOT is_xcode_bundle_identifier_given
@amirmasoudabdol
amirmasoudabdol / truncated_multivariate_normal_distribution.hpp
Created October 23, 2019 18:01
STL-like Implementation of Truncated Multivariate Normal Random Number Generator
#include <random>
#include <iostream>
#include <armadillo>
#include "boost/math/distributions/normal.hpp"
using boost::math::normal;
// Truncated Normal Distribution
template <class _RealType = double>
import time
from functools import wraps
def profiling_decorator(f):
@wraps(f)
def wrapped_f(*args, **kwargs):
start_time = time.time()
res = f(*args, **kwargs)
end_time = time.time()
elapsed_time = end_time - start_time
@amirmasoudabdol
amirmasoudabdol / geom_sand.R
Last active September 19, 2018 12:01
GeomSand
stat_sand <- function(mapping = NULL,
data = NULL,
position = 'identity',
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...) {
layer(
stat = StatSand,
geom = GeomSand,
@amirmasoudabdol
amirmasoudabdol / geom_sand.R
Last active September 17, 2018 13:39
Sample ggextension
stat_sand <- function(mapping = NULL,
data = NULL,
position = 'identity',
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
# This code will reproduce the production-ready plot reperested in following blogpost, https://panic.com/blog/mystery-of-the-slow-downloads/
# There might be some slight misplacements due to the font spacing, I've used Nitti Grotesk.
library(tidyverse)
library(lubridate)
library(ggthemes)
library(showtext)
# font_add("Nitti Grotesk", "Typefaces/Nitti Grotesk/NittiGrotesk-Normal.otf")
# font_add("Nitti Grotesk Bold", "Typefaces/Nitti Grotesk/NittiGrotesk-Bold.otf")
@amirmasoudabdol
amirmasoudabdol / read_csv.c
Created May 19, 2014 09:59
To read the CSV file in C
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void read_csv(int row, int col, char *filename, double **data){
FILE *file;
file = fopen(filename, "r");
int i = 0;
### Keybase proof
I hereby claim:
* I am amirmasoudabdol on github.
* I am amirmasoudabdol (https://keybase.io/amirmasoudabdol) on keybase.
* I have a public key whose fingerprint is 9ED9 378E EC7B DE99 30B9 17F4 B687 5E7E 3688 939C
To claim this, I am signing this object: