Skip to content

Instantly share code, notes, and snippets.

@tansy
tansy / d2u-dir-1.sh
Last active February 1, 2024 15:55
dos2unix whole directory, keeping timestamps
#!/bin/sh
if [ $# -eq 0 ]; then
echo "dos2unix whole directory, keeping timestamps"
echo ""
echo "$0 <directory1/dos> <directory2/ux>"
echo "it will copy contents of <dir1> to <dir2> changing new lines from dos to unix"
exit 0
fi
@tansy
tansy / bin2hex-2.c
Created January 13, 2020 03:32
Convert binary input into hexadecimal stream.
///////////////////////////////////////////////////////////////////////////////
//
// \file bin2hex-2.c
// \brief Converts binary input to hexadecimal
// \usage assuming your program prints output to stdout
// $ echo -n "Lorem ipsum" | bin2hex
// $ cat file.bin | bin2hex
// or you can convince shell to do the job for you
// $ bin2hex < file.bin > file.bin.hex
//