Skip to content

Instantly share code, notes, and snippets.

@dereksz
dereksz / utils.sh
Created August 28, 2021 04:09
Useful Commands for Tidying up my File System
# rmlint
# Pre-run to generate checksumms & attach in extended attributes
rmlint --xattr --progress <some dirs> -- <master dir>
# Renaming image files dith date rather than DSC...
find -iname 'DSC*.jpg' -execdir renrot --mtime --name-template="%Y-%m-%d@%H'%M'%S" -- "{}" \+
# Need to use `-execdir`r `renrot` will move all files to current folder.
@dereksz
dereksz / X.Rmd
Last active August 25, 2021 23:02
My custom CSS file for my RMarkdown Documents
---
title: "..."
author: "..."
date: "`r format(Sys.time(), '%d %B %Y (%X)')`"
output:
rmdformats::readthedown:
keep_md: true
self_contained: false
toc_depth: 6
toc_collapsed: no
@dereksz
dereksz / comp-test.md
Last active July 24, 2021 00:25
Compression Tool Test

Base

436M Jul 23 22:59 julia5.1e10.varint

plzip

446.48s user 0.87s system 678% cpu 1:05.90 total
@dereksz
dereksz / TreeReorg.sh
Last active August 29, 2015 14:10
Reorganizing files in directory tree
# Create relative sha1 deep files
sha1deep -rel . | tee sha1deep.log
# Create missing dirs referenced in a SHA1sum file
sed -re 's/^[0-9a-f]+\s+//;s!/[^/]*$!!' SD.log | sort -u | xargs -I{} mkdir -p "{}"
# Take two md5deep checksum files and re-arrange one directory based on the other
join -j1 <(sed -re 's/ +/ "/;s/$/"/' 1.4Tb.log | sort) <(sed -re 's/ +/ "/;s/$/"/' SD.log | sort) |
sed -re 's/^[0-9a-f]+/mv -v /' |
bash
@dereksz
dereksz / git-one-liners.sh
Created November 30, 2014 22:34
useful git one-liners
# Find UNICODE files
find -name '*.tt' | xargs -I{} file {} | grep -F 'UTF-16'
# Modified files - check types
git status -s | sed -nre 's/^ M //p' |
xargs -I{} file {} # and check the files 'type' (looking for unicode madness here!)cd ..