From 8b4b5107bc40aa8e4d5dfece7b582494c7cde068 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Mon, 24 Oct 2022 23:04:53 -0700 Subject: Ruin my poor disk --- entries/braxtonhall/wc/.gitignore | 1 + entries/braxtonhall/wc/fib.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 entries/braxtonhall/wc/.gitignore create mode 100644 entries/braxtonhall/wc/fib.sh (limited to 'entries') diff --git a/entries/braxtonhall/wc/.gitignore b/entries/braxtonhall/wc/.gitignore new file mode 100644 index 0000000..f845a7d --- /dev/null +++ b/entries/braxtonhall/wc/.gitignore @@ -0,0 +1 @@ +*.fib \ No newline at end of file diff --git a/entries/braxtonhall/wc/fib.sh b/entries/braxtonhall/wc/fib.sh new file mode 100644 index 0000000..c909617 --- /dev/null +++ b/entries/braxtonhall/wc/fib.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +rec () { + shopt -s nullglob dotglob + + if [ $2 == "0" ]; then + : + elif [ $2 == "1" ]; then + echo "🥵" > "$1/$2.fib" + else + mkdir "$1/$2" + rec "$1/$2" $(($2 - 1)) + rec "$1/$2" $(($2 - 2)) + fi +} + +rec $(pwd) $1 +find $(pwd)/$1 -type f | wc -l -- cgit v1.2.3-70-g09d2 From ccfa3ef5a9d811a003d6fa9701b9f1e27f44ce33 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Mon, 24 Oct 2022 23:36:28 -0700 Subject: Make wc a little bit safer --- entries/braxtonhall/wc/fib.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'entries') diff --git a/entries/braxtonhall/wc/fib.sh b/entries/braxtonhall/wc/fib.sh index c909617..fc419b3 100644 --- a/entries/braxtonhall/wc/fib.sh +++ b/entries/braxtonhall/wc/fib.sh @@ -1,18 +1,22 @@ #!/bin/bash -rec () { - shopt -s nullglob dotglob +function rec () { if [ $2 == "0" ]; then : elif [ $2 == "1" ]; then - echo "🥵" > "$1/$2.fib" + [ -f "$1/$2.fib" ] || echo "🥵" > "$1/$2.fib" else - mkdir "$1/$2" + [ -d "$1/$2" ] || mkdir "$1/$2" rec "$1/$2" $(($2 - 1)) rec "$1/$2" $(($2 - 2)) fi } -rec $(pwd) $1 -find $(pwd)/$1 -type f | wc -l +if [[ $1 =~ ^[0-9]+$ ]]; then + rec $(pwd) $1 + find $(pwd)/$1 -type f | wc -l +else + echo "Please provide a natural number!" + exit 1 +fi -- cgit v1.2.3-70-g09d2 From 4dd0baf52bacfbf539d0277a528dd4213aede60b Mon Sep 17 00:00:00 2001 From: Lucas Zamprogno Date: Mon, 24 Oct 2022 22:30:36 -0700 Subject: Node things --- entries/lucaszamprogno/fib.js | 1 + entries/lucaszamprogno/package.json | 14 ++++++++++++++ people.json | 11 +++++++++++ 3 files changed, 26 insertions(+) create mode 100644 entries/lucaszamprogno/fib.js create mode 100644 entries/lucaszamprogno/package.json (limited to 'entries') diff --git a/entries/lucaszamprogno/fib.js b/entries/lucaszamprogno/fib.js new file mode 100644 index 0000000..bd5da6b --- /dev/null +++ b/entries/lucaszamprogno/fib.js @@ -0,0 +1 @@ +console.log(require('fibonacci-series')(process.argv[2])) \ No newline at end of file diff --git a/entries/lucaszamprogno/package.json b/entries/lucaszamprogno/package.json new file mode 100644 index 0000000..c5b9529 --- /dev/null +++ b/entries/lucaszamprogno/package.json @@ -0,0 +1,14 @@ +{ + "name": "fib", + "version": "1.0.0", + "description": "", + "main": "fib.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "fibonacci-series": "1.0.1" + }, + "author": "Lucas Zamprogno", + "license": "ISC" +} diff --git a/people.json b/people.json index cc5e8e3..3f18dbf 100644 --- a/people.json +++ b/people.json @@ -70,6 +70,17 @@ } ] }, + { + "github": "LucasZamprogno", + "name": "Lucas Zamprogno", + "title": "MSc, UBC", + "entries": [ + { + "name": "node", + "link": "./entries/lucaszamprogno/fib.js" + } + ] + }, { "github": "margoseltzer", "name": "Margo Seltzer", -- cgit v1.2.3-70-g09d2 From 2c3c3f0fe28f96731342d6f5fafff35a5714791d Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Mon, 24 Oct 2022 23:52:13 -0700 Subject: ensure wc-fib(1)=1 --- entries/braxtonhall/wc/.gitignore | 2 +- entries/braxtonhall/wc/fib.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'entries') diff --git a/entries/braxtonhall/wc/.gitignore b/entries/braxtonhall/wc/.gitignore index f845a7d..0aafc44 100644 --- a/entries/braxtonhall/wc/.gitignore +++ b/entries/braxtonhall/wc/.gitignore @@ -1 +1 @@ -*.fib \ No newline at end of file +**/1 \ No newline at end of file diff --git a/entries/braxtonhall/wc/fib.sh b/entries/braxtonhall/wc/fib.sh index fc419b3..1759dff 100644 --- a/entries/braxtonhall/wc/fib.sh +++ b/entries/braxtonhall/wc/fib.sh @@ -5,7 +5,7 @@ function rec () { if [ $2 == "0" ]; then : elif [ $2 == "1" ]; then - [ -f "$1/$2.fib" ] || echo "🥵" > "$1/$2.fib" + [ -f "$1/$2" ] || echo "🥵" > "$1/$2" else [ -d "$1/$2" ] || mkdir "$1/$2" rec "$1/$2" $(($2 - 1)) -- cgit v1.2.3-70-g09d2