Skip to content

Instantly share code, notes, and snippets.

View gipert's full-sized avatar

Luigi Pertoldi gipert

View GitHub Profile
@gipert
gipert / doit.sh
Created November 11, 2023 19:12
One liner download all Particle Data Group review PDF documents in parallel
wget -q -O- https://pdg.lbl.gov/2023/reviews/contents_sports.html \
| sed -nr 's/.+href="(rpp.+-rev-.+\.pdf)".+/\1/p' \
| parallel wget -nv https://pdg.lbl.gov/2023/reviews/{}
@gipert
gipert / jlcode.sty
Last active May 21, 2020 22:31
jlcode + lstfiracode MWE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% jlcode.sty
%%% Copyright 2018 GitHub user wg030
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any
%% later version.
%% The latest version of this license is in
@gipert
gipert / itunes-on-arch-linux-guide.md
Created May 10, 2020 00:49
iTunes on (Arch) Linux: installation guide

Prerequisites

  1. Enable the multilib repository by editing /etc/pacman.conf
  2. Install WineHQ and some other optional dependencies:
    $ pacman -Syu wine
    $ pacman -S --asdeps lib32-mpg123 lib32-gnutls {lib32-,}gst-plugins-base-libs \
                         lib32-alsa-plugins lib32-libpulse lib32-openal
    $ yay -S lib32-unixodbc # or your favourite AUR helper
  3. We'll install a 64-bit version of iTunes, so no need to set WINEARCH
@gipert
gipert / poisson_bands.hpp
Last active March 4, 2021 09:47
Poisson smallest interval computing and drawing utilities. Ref: https://doi.org/10.1140/epjp/i2012-12024-0
/* poisson_bands.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 / ROOTmacro_cmdline_args.C
Last active August 18, 2020 12:14
Template ROOT macro that can be executed directly with command-line arguments
//usr/bin/env root -l ${0}\(\""${0}"\",\""${*}"\"\); exit $?
/* ROOTmacro_cmdline_args.C
*
* template ROOT macro that can be executed (do not forget to
* `chmod +x`) with command-line arguments
*
* Author: Luigi Pertoldi - pertoldi@pd.infn.it
* Created: Sun 24 Mar 2019
*/
@gipert
gipert / daemon.sh
Created April 29, 2019 15:12
Simple skeleton for auto-daemonizing bash script
#!/bin/bash
#
# simple bash daemon skeleton
#
# Author: Luigi Pertoldi - luigi.pertoldi@hotmail.it
# Created: Mon 29 Apr 2019
usage() {
echo >&2 "USAGE: `basename $0` [OPTIONS]"
echo >&2 ""
@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 = [&]() {
@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 / 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 / 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!