Skip to content

Instantly share code, notes, and snippets.

@kapcom01
kapcom01 / snp
Created February 15, 2020 13:41 — forked from erikw/snp
snp: Wrap shell command in BTRFS snapper pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in btrfs snapper pre-post snapshots.
# Usage: $ snp <commands>
# e.g.: $ snp pacman -Syyu
log_path="/var/local/log/snp"
date=$(date "+%Y-%m-%d-%H%M%S")
log_file="${log_path}/snp_${date}.log"
! [ -d $log_path ] && mkdir -p $log_path
#! /bin/bash
user=manolis
backups=/home/manolis/backups
if [[ $EUID > 0 ]]
then echo "Please run as root"
exit
fi
@kapcom01
kapcom01 / eLOC.pl
Created December 16, 2013 02:00 — forked from anonymous/eLOC.pl
#!/usr/bin/perl -w
# eLOC - Effective Lines of Code Counter
# JFS (2005)
#
use strict;
use warnings;
use sigtrap;
use diagnostics;
use warnings::register;