Skip to content

Instantly share code, notes, and snippets.

@JaMo42
JaMo42 / rdiff
Last active April 24, 2023 12:18
Diff remote files
#!/usr/bin/sh
#
# Usage: rdiff file1 file2 [diff options]
#
# Does a diff of file1 and file2, passing any extra arguments to the diff command.
# If there are no extra arguments, "-u --color" is used as arguments to diff.
# If either file is not found it is passed to scp to retrieve the file.
#
file_a=$1
@JaMo42
JaMo42 / print.hpp
Created February 12, 2021 13:06
Simple print function with argument substitution
// Basic print function with argument substitution.
// Prints the format string, replacing `{}` with a value from the arguments
// list.
// If no more arguments are available, the rest of the format string is
// printed literally. If no {} is present in the format string, it is printed
// literally and any excess arguments are ignored.
// `{{` can be used to escape an opening parenthesis.
// Output is written to a `std::ostream`.
#pragma once
#include <iostream>
@JaMo42
JaMo42 / timer.hpp
Last active December 19, 2019 09:44
C++ Timer class
#ifndef TIMER_HPP
#define TIMER_HPP
#include <chrono>
/**
* @tparam TickPeriod - The tick period to use for elapsed times (default std::milli)
* @tparam Clock - The clock class to use (default std::chrono::steady_clock)
*/
template<
class TickPeriod = std::milli,