Skip to content

Instantly share code, notes, and snippets.

View gipert's full-sized avatar

Luigi Pertoldi gipert

View GitHub Profile
@gipert
gipert / vim-cheat-sheet.md
Last active February 28, 2019 15:09
Vim cheat sheet
@gipert
gipert / # gcc - 2018-05-09_12-43-25.txt
Created May 9, 2018 10:46
gcc on "Scientific Linux release 7.4 (Nitrogen)" - Homebrew build logs
Homebrew build logs for gcc on "Scientific Linux release 7.4 (Nitrogen)"
Build date: 2018-05-09 12:43:25
@gipert
gipert / # gcc - 2018-05-09_12-54-43.txt
Created May 9, 2018 10:57
gcc on "Scientific Linux release 7.4 (Nitrogen)" - Homebrew build logs
Homebrew build logs for gcc on "Scientific Linux release 7.4 (Nitrogen)"
Build date: 2018-05-09 12:54:43
@gipert
gipert / # gcc - 2018-05-12_19-22-46.txt
Created May 12, 2018 17:39
gcc on "Scientific Linux release 7.4 (Nitrogen)" - Homebrew build logs
Homebrew build logs for gcc on "Scientific Linux release 7.4 (Nitrogen)"
Build date: 2018-05-12 19:22:46
@gipert
gipert / stat-proj-INSS18.jl
Last active May 31, 2018 08:59
Tiny Julia script to verify the the validity of the Wilk's theorem for a particular test statistics
using StatsBase, Distributions, Optim, ProgressMeter, Plots
nexp = 100000 # number of simulated experiments
nobs_mean = 1000 # number of expected counts in experiment
function logL(μ, h::Histogram) # compute -log(L(μ))
logL = 0.0
# loop over bins
for b in 1:length(h.edges[1])-1
low = h.edges[1][b]
@gipert
gipert / paul_tol_colors.hpp
Last active September 22, 2023 11:45
Implementation of Paul Tol's color palette for ROOT CERN macros https://personal.sron.nl/~pault/data/colourschemes.pdf
/* paul_tol_colors.hpp
*
* Copyright (c) 2019 Luigi Pertoldi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@gipert
gipert / bayesian_blocks.jl
Last active January 14, 2019 21:53
Julia implementation of the bayesian blocks algorithm, as described in https://arxiv.org/abs/1207.5578. Developement moved to https://github.com/gipert/bayesian-blocks
#= bayesian_blocks.jl
=
= Author: Luigi Pertoldi - pertoldi@pd.infn.it
= Created: 29 Jun 2018
=
= The following software is distributed under the MIT licence
= http://www.opensource.org/licenses/mit-license.php
= Copyright (c) 2018 Luigi Pertoldi
=
= Use Julia >= v0.7!
@gipert
gipert / let-shared-folder-group.sh
Last active June 8, 2019 10:34
Set-up shared folders
#!/bin/bash
# first assign to your directory the permissions/ownership you want
chgrp -R gerda $1
chmod -R ug+rwX,o-rwx $1
# the sticky bit is needed to preserve the group ownership
chmod g+s `find $1 -type d`
# the others won't be able to see anything...
@gipert
gipert / cpplog.hpp
Last active July 2, 2019 13:05
Basic C++ logger
/* cpplog.hpp
*
* Author: Luigi Pertoldi
* Created: Tue 02 Jul 2019
*
* Usage:
*
* logging::min_level = logging::info;
* logging::out(info) << "the program is doing well" << std::endl;
* logging::out(error) << "an error occurred!" << std::endl;
@gipert
gipert / getopt.cc
Last active May 6, 2019 16:17
Simple getopt example for bash
#include <getopt.h>
#include <iostream>
#include <string>
#include <vector>
int main(int argc, char** argv) {
std::string progname(argv[0]);
auto usage = [&]() {