From db3734cf46f8138c8137e8438e534242860ffee9 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 2 Dec 2018 00:28:46 -0500 Subject: Solve day 2 part 1 --- 2018/day02-1.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 2018/day02-1.sh (limited to '2018') diff --git a/2018/day02-1.sh b/2018/day02-1.sh new file mode 100644 index 0000000..695959f --- /dev/null +++ b/2018/day02-1.sh @@ -0,0 +1,19 @@ +alpha='a b c d e f g h i j k l m n o p q r s t u v w x y z' +twos() { + for a in $alpha; do + tr -c -d "$a\n" < $1 \ + | grep -n '^..$' \ + | cut -d ':' -f 1 + done | sort -u | wc -l +} +threes() { + for a in $alpha; do + tr -c -d "$a\n" < $1 \ + | grep -n '^...$' \ + | cut -d ':' -f 1 + done | sort -u | wc -l +} +input=$(mktemp) +cat > $input +echo $(( $(twos $input) * $(threes $input) )) +rm $input -- cgit 1.4.1 d class='sub right'>
summary refs log tree commit diff
path: root/.ssh (unfollow)
Commit message (Expand)Author
2016-09-16Disable custom login command for local iTerm profileJune McEnroe
2016-09-16Add tux profile to iTermJune McEnroe
2016-09-15Use err(3) in xxJune McEnroe
2016-09-15Use sysexits.h in xxJune McEnroe
2016-09-15Use strtoul in xxJune McEnroe
2016-09-15Write xx usage to stderrJune McEnroe
2016-09-13Use nvim as MANPAGERJune McEnroe
2016-09-13Use return value of getopt in xxJune McEnroe
2016-09-12Compile xx.c with clang specificallyJune McEnroe
2016-09-12Prevent offset from xx when reading zeroJune McEnroe
2016-09-12Rewrite xx.cJune McEnroe
2016-09-12Fix ascii alignment in xxJune McEnroe
2016-09-12Add -s flag to xxJune McEnroe
2016-09-12Add -a flag to xxJune McEnroe
2016-09-12Add -o flag to xxJune McEnroe
2016-09-12Add -g option to xxJune McEnroe
2016-09-12Add -c option to xxJune McEnroe
2016-09-12Add .bin/xx.cJune McEnroe
2016-09-08Rename colorscheme to lameJune McEnroe
2016-09-04Simplify colors syntax in zsh promptJune McEnroe
2016-08-29Color rubyStringDelimiter as StringJune McEnroe
2016-08-24Highlight rubyDefine as StructureJune McEnroe
2016-08-23Remove scroll bindings from nvim configJune McEnroe
2016-08-17Highlight Search with black foregroundJune McEnroe
2016-08-15Remove gruvboxJune McEnroe
2016-08-04Remove march from SSH configJune McEnroe
2016-08-01Disable tab indicators in iTermJune McEnroe
2016-07-30Color PreProc DarkGreenJune McEnroe
2016-07-29Color Structure and Typedef in grayJune McEnroe
2016-07-27Color comments DarkBlue and LightBlueJune McEnroe
2016-07-27Color macros in yellowJune McEnroe
2016-07-26Colorscheme colors and schemesJune McEnroe
2016-07-26Add ''subtle'' colorschemeJune McEnroe
2016-07-26Add htoprcJune McEnroe
2016-07-24Add may and refactor ssh configJune McEnroe
2016-07-18Disable cursorlineJune McEnroe
2016-07-18Use hard constrast gruvbox darkJune McEnroe
2016-07-15Remove vim configurationJune McEnroe
2016-07-15Add readline to README configurations listJune McEnroe
2016-07-15Add vendor script to READMEJune McEnroe
2016-07-15Pull latest pathogen and gruvboxJune McEnroe