Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Cristian Consonni CristianCantoro

🎯
Focusing
Block or report user

Report or block CristianCantoro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@CristianCantoro
CristianCantoro / # libproxy - 2018-10-27_16-27-17.txt
Created Oct 27, 2018
libproxy on Ubuntu 16.04.5 LTS - Homebrew build logs
View # libproxy - 2018-10-27_16-27-17.txt
Homebrew build logs for libproxy on Ubuntu 16.04.5 LTS
Build date: 2018-10-27 16:27:17
@CristianCantoro
CristianCantoro / example.py
Last active Jun 27, 2018
Using docopts for bash and docopt for python
View example.py
#!/usr/bin/env python3
"""
Usage:
example.sh [options]
example.sh ( -h | --help )
example.sh ( --version )
Options:
-a, --all An optional flaag.
-b Another optional flag.
@CristianCantoro
CristianCantoro / scoping.sh
Last active May 31, 2018
Variable scoping in bash
View scoping.sh
#!/bin/bash
function hello() {
local fname="$1"
echo "Ciao, $fname"
}
echo "Ereditato dal terminale"
echo "\$USER: $USER"
@CristianCantoro
CristianCantoro / signal.sh
Last active May 25, 2018
Testing `nohup`, `&` and `disown`
View signal.sh
#!/usr/bin/env bash
# shellcheck disable=SC2128
SOURCED=false && [ "$0" = "$BASH_SOURCE" ] || SOURCED=true
if ! $SOURCED; then
set -euo pipefail
IFS=$'\n\t'
fi
mypid="$$"
@CristianCantoro
CristianCantoro / esempio.sh
Last active May 25, 2018
Example script with docopts
View esempio.sh
#!/usr/bin/env bash
# shellcheck disable=SC2128
SOURCED=false && [ "$0" = "$BASH_SOURCE" ] || SOURCED=true
debug=false
parallel=false
query=''
topic=''
read -rd '' docstring <<EOF
@CristianCantoro
CristianCantoro / tsp.h
Created May 15, 2018
An header that works for C and C++
View tsp.h
#ifndef TSP_H
#define TSP_H
#ifdef __cplusplus
// C++ code
using namespace std;
namespace helpers {
long long get_elapsed_time(void);
bool has_reached_timeout(void);
@CristianCantoro
CristianCantoro / histo_timestamps.py
Last active Mar 13, 2018
Create a histograms with time on the x-axis using arrow and matplotlib
View histo_timestamps.py
#!/usr/bin/env python
import argparse
import arrow
from matplotlib import pyplot as plt
from matplotlib import dates as mdates
def get_args():
description=('Make an histogram from a list of timestamps')
@CristianCantoro
CristianCantoro / backup_restic.sh
Last active Feb 9, 2018
Backup script for restic
View backup_restic.sh
#!/usr/bin/env bash
# shellcheck disable=SC2128
SOURCED=false && [ "$0" = "$BASH_SOURCE" ] || SOURCED=true
if ! $SOURCED; then
set -euo pipefail
IFS=$'\n\t'
fi
awk_script=$(cat <<'AWKSCRIPT'
You can’t perform that action at this time.