├── .gitignore ├── .github └── FUNDING.yml ├── examples ├── german.bcrds ├── maori.bcrds ├── serbian.bcrds ├── french.bcrds ├── spanish.bcrds ├── maths.bcrds ├── swedish.bcrds └── icelandic.bcrds ├── default.nix ├── shell.nix ├── install ├── derivation.nix ├── CHANGELOG.md ├── bashcards.8 ├── nix ├── sources.json └── sources.nix ├── LICENSE ├── README.md └── bashcards /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: rpearce 4 | -------------------------------------------------------------------------------- /examples/german.bcrds: -------------------------------------------------------------------------------- 1 | Goodbye=Auf Wiedersehen 2 | Hello=Hallo 3 | I love you=Ich liebe dich 4 | We are very happy=Wir sind sehr glücklich 5 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | sources = import ./nix/sources.nix; 3 | in 4 | { pkgs ? import sources.nixpkgs { } }: 5 | pkgs.callPackage ./derivation.nix { } 6 | -------------------------------------------------------------------------------- /examples/maori.bcrds: -------------------------------------------------------------------------------- 1 | paraoa=bread 2 | huarākau=fruit 3 | hēki=egg 4 | tīhi=cheese 5 | parakuihi=breakfast 6 | ika=fish 7 | whāoka=fork 8 | maripi=knife 9 | hararore=mushroom 10 | hupa=soup 11 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | let 2 | sources = import ./nix/sources.nix; 3 | pkgs = import sources.nixpkgs { }; 4 | bashcards = pkgs.callPackage ./derivation.nix { }; 5 | in 6 | pkgs.mkShell { 7 | buildInputs = with pkgs; [ 8 | bashcards 9 | man 10 | niv 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /examples/serbian.bcrds: -------------------------------------------------------------------------------- 1 | сир (sir)=cheese 2 | јаје=egg 3 | риба (riba)=fish 4 | виљушка (viluška)=fork 5 | супа (supa)=soup 6 | печурка (pečurka)=mushroom 7 | нож (nož)=knife 8 | лимун (limun)=limun 9 | месо (meso)=meat 10 | кашика (kašika)=spoon 11 | шећер (šećer)=sugar 12 | салата (salata)=salad 13 | једем (jedem)=I eat 14 | кувам (kuvam)=I cook 15 | бадем (badem)=almond 16 | сланина (slanina)=bacon 17 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o errtrace 5 | set -o nounset 6 | set -eou pipefail 7 | 8 | TARGET_PATH="/usr/local/bin/bashcards" 9 | EXECUTABLE_URL="https://raw.githubusercontent.com/rpearce/bashcards/main/bashcards" 10 | 11 | install_bashcards() { 12 | curl \ 13 | -o "$TARGET_PATH" \ 14 | -fsSL "$EXECUTABLE_URL" 15 | 16 | chmod +x "$TARGET_PATH" 17 | 18 | echo "Installed $TARGET_PATH from $EXECUTABLE_URL" 19 | } 20 | 21 | install_bashcards 22 | -------------------------------------------------------------------------------- /examples/french.bcrds: -------------------------------------------------------------------------------- 1 | l’homme=the man 2 | le garçon=the boy 3 | le chat=the cat 4 | la femme=the woman 5 | la fille=the girl 6 | je=I 7 | le cheval=the horse 8 | le chien=the dog 9 | Marie mange=Marie is eating 10 | Ça va=I am fine 11 | C’est bien=It is good 12 | Comment ça va?=How are you doing? 13 | Ça va bien=I am doing well 14 | Bonsoir=Good evening 15 | Ça va très bien=I am doing very well 16 | Salut=Hi 17 | Bonne soirèe=Good evening 18 | enchenté=nice to meet you 19 | À bientôt !=See you soon! 20 | -------------------------------------------------------------------------------- /derivation.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs }: 2 | 3 | pkgs.stdenv.mkDerivation { 4 | name = "bashcards"; 5 | src = ./.; 6 | dontBuild = true; 7 | installPhase = '' 8 | mkdir -p $out/bin $out/share/man/man8 9 | cp bashcards.8 $out/share/man/man8/ 10 | cp bashcards $out/bin/ 11 | ''; 12 | meta = { 13 | description = "Practice flashcards in bash"; 14 | homepage = "https://github.com/rpearce/bashcards/"; 15 | license = lib.licenses.bsd3; 16 | maintainers = with lib.maintainers; [ rpearce ]; 17 | platforms = lib.platforms.all; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.1.3] - 2020-08-30 9 | 10 | ### Fixed 11 | 12 | * shellcheck warnings 13 | 14 | ## [0.1.2] - 2020-05-09 15 | 16 | ### Fixed 17 | 18 | * include missing version information 19 | 20 | ### Fixed 21 | 22 | * use `printf` instead of `clear` to clear the screen 23 | 24 | ## [0.1.1] - 2020-05-09 25 | 26 | ### Fixed 27 | 28 | * use `printf` instead of `clear` to clear the screen 29 | 30 | ## [0.1.0] - 2020-05-09 31 | 32 | ### Added 33 | 34 | * all the things 35 | -------------------------------------------------------------------------------- /examples/spanish.bcrds: -------------------------------------------------------------------------------- 1 | goodbye=adiós 2 | hello=hola 3 | I love you=Te quiero. 4 | We are very happy.=Nos alegra muchísimo. 5 | to come=venir 6 | to stay=quedar 7 | to arrive=llegar 8 | to return / go back=volver 9 | Of course.=Por supuesto. 10 | to shower=duchar 11 | I would like=quisiera 12 | the spoon=la cuchara 13 | the forks=los tenedores 14 | Can you bring two knives?=¿Puede traer dos cuchillos? 15 | How do you feel today?=¿Cómo te sientes hoy? 16 | the room=la habitación 17 | to look for=buscar 18 | size=talla 19 | we can=podemos 20 | I know=Lo sé 21 | to stay=quedar 22 | granja=farm 23 | ruido=noise 24 | algo=something 25 | alguien=someone 26 | ahí=there 27 | pedazo=piece 28 | manejar=to drive 29 | De repente=suddenly 30 | Encontré=I found 31 | ya=already 32 | -------------------------------------------------------------------------------- /bashcards.8: -------------------------------------------------------------------------------- 1 | .\" Manpage for bashcards. 2 | .\" Contact me@robertwpearce.com to correct errors or typos. 3 | .TH man 8 "30 August 2020" "0.1.3" "bashcards man page" 4 | .SH NAME 5 | bashcards \- Practice flashcards in bash 6 | .SH SYNOPSIS 7 | bashcards [-v,--version] [-h|--help] [-d directory] 8 | .SH DESCRIPTION 9 | bashcards is a bash program for practicing flashcards in bash. 10 | .SH OPTIONS 11 | .TP 12 | .BR -d,--dir 13 | Directory containing bashcard files (*.bcrds). Each file should contain a group 14 | of bashcards (one per line) formatted as front=back. If not provided, default 15 | bashcard values will be used. 16 | .TP 17 | .BR -h,--help 18 | See this help information 19 | .TP 20 | .BR -v,--version 21 | Current version 22 | .SH BUGS 23 | No known bugs. 24 | .SH AUTHOR 25 | Robert W. Pearce (me@robertwpearce.com) 26 | -------------------------------------------------------------------------------- /examples/maths.bcrds: -------------------------------------------------------------------------------- 1 | axiom=A fundamental assumption regarding the object of study that is accepted without proof 2 | conjecture=An unproved statement that is believed to be true 3 | corollary=A theorem of less importance which can be readily deduced from a previous, more notable statement 4 | lemma=A generally minor, proven proposition which is used as a stepping stone to a larger result 5 | predicate=A statement that is either true or false depending on the values of the variables within it 6 | proof=An inferential argument for a mathematical statement, showing that the stated assumptions logically guarantee the conclusion 7 | proposition=A theorem of lesser importance, or one that is considered so elementary or immediately obvious, that it may be stated without proof 8 | theorem=A statement that has been proven to be true based on axioms or other theorems 9 | -------------------------------------------------------------------------------- /nix/sources.json: -------------------------------------------------------------------------------- 1 | { 2 | "niv": { 3 | "branch": "master", 4 | "description": "Easy dependency management for Nix projects", 5 | "homepage": "https://github.com/nmattia/niv", 6 | "owner": "nmattia", 7 | "repo": "niv", 8 | "rev": "9d35b9e4837ab88517210b1701127612c260eccf", 9 | "sha256": "0q50xhnm8g2yfyakrh0nly4swyygxpi0a8cb9gp65wcakcgvzvdh", 10 | "type": "tarball", 11 | "url": "https://github.com/nmattia/niv/archive/9d35b9e4837ab88517210b1701127612c260eccf.tar.gz", 12 | "url_template": "https://github.com///archive/.tar.gz" 13 | }, 14 | "nixpkgs": { 15 | "branch": "nixos-20.09", 16 | "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", 17 | "homepage": "https://github.com/NixOS/nixpkgs", 18 | "owner": "nixos", 19 | "repo": "nixpkgs", 20 | "rev": "95d26c9a9f2a102e25cf318a648de44537f42e09", 21 | "sha256": "0ymhj252dq7z2ajdjsdz99h106ylm4vsmz5v3xiwsylcs4bz2nl8", 22 | "type": "tarball", 23 | "url": "https://github.com/nixos/nixpkgs/archive/95d26c9a9f2a102e25cf318a648de44537f42e09.tar.gz", 24 | "url_template": "https://github.com///archive/.tar.gz" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Robert Pearce 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bashcards 2 | 3 | Practice flashcards in your terminal 4 | 5 | _Note: requires bash v4_ 6 | 7 | ## Usage 8 | 9 | ``` 10 | λ bashcards -d path/to/bcards/directory 11 | What would you like to practice? 12 | 1. german 13 | 2. spanish 14 | 3. swedish 15 | > 2 16 | Spanish 17 | 18 | ––––––––––––––– 19 | | | 20 | | Te quiero | 21 | | | 22 | ––––––––––––––– 23 | (Press return to flip) 24 | 25 | –––––––––––––––– 26 | | | 27 | | I love you | 28 | | | 29 | –––––––––––––––– 30 | (Press return for next card) 31 | ``` 32 | 33 | ## Installation 34 | 35 | There are a couple of different ways to use this project. 36 | 37 | ### Nix 38 | 39 | To install via [nixpkgs](https://github.com/nixos/nixpkgs): 40 | 41 | ``` 42 | λ nix-env -i bashcards 43 | ``` 44 | 45 | ### Install Script 46 | 47 | ``` 48 | λ /usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/rpearce/bashcards/main/install)" 49 | ``` 50 | 51 | ### Clone the Repository 52 | 53 | ``` 54 | λ git clone https://github.com/rpearce/bashcards.git 55 | λ cd bashcards 56 | λ ./bashcards -d path/to/bcards/directory 57 | ``` 58 | 59 | You can also use it in `nix-shell`: 60 | 61 | ``` 62 | λ nix-shell --pure 63 | [nix-shell:~/projects/bashcards]$ man bashcards 64 | [nix-shell:~/projects/bashcards]$ bashcards -d path/to/bcards/directory 65 | ``` 66 | 67 | ### Download a Release 68 | 69 | [Specific releases](https://github.com/rpearce/bashcards/releases) can be 70 | downloaded and used just like the `Clone the Repository` section above. 71 | 72 | ## Creating `.bcrds` files 73 | 74 | To add some Spanish and Swedish bashcards, for example, all you need to do is 75 | create two files, `spanish.bcrds` and `swedish.bcrds`, and add lines to the 76 | files that take the form `key=value`. 77 | 78 | ``` 79 | λ mkdir /path/to/bcards/directory && cd $_ 80 | λ touch spanish.bcrds swedish.bcrds 81 | λ cat < spanish.bcrds 82 | goodbye=adiós 83 | hello=hola 84 | I love you=Te quiero. 85 | EOF 86 | λ cat < swedish.bcrds 87 | Goodbye=Adjö 88 | Hello=Hallå 89 | I love you=Jag älskar dig 90 | EOF 91 | ``` 92 | 93 | Once your cards are in a folder somewhere, you simply tell `bashcards` where to 94 | find them! 95 | 96 | ``` 97 | λ bashcards -d path/to/bcards/directory 98 | What would you like to practice? 99 | 1. spanish 100 | 2. swedish 101 | > 102 | ``` 103 | 104 | There are example `.bcrds` files in the [examples/](./examples) folder of this 105 | project. 106 | -------------------------------------------------------------------------------- /examples/swedish.bcrds: -------------------------------------------------------------------------------- 1 | Goodbye=Adjö 2 | Hello=Hallå 3 | I love you=Jag älskar dig 4 | We are very happy=Vi är väldigt lyckliga 5 | a newspaper=En tidning 6 | They are women=De är kvinnor 7 | You are reading=Ni läser 8 | Yes, thank you very much!=Ja, tack så mycket! 9 | No, goodbye=Nej, hej då 10 | the man=mannen 11 | The man is drinking=Mannen dricker 12 | The woman eats bread=Kvinnan äter bröd 13 | water=vatten 14 | girl=flicka 15 | boy=pojke 16 | hon=she 17 | han=he 18 | sorry=ursäkta 19 | please=snälla 20 | You are welcome=Varsågod 21 | love=älskar 22 | I do not speak Swedish=Jag talar inte svenska 23 | The man likes the woman=Mannen tycker om kvinnan 24 | you have=du har 25 | ett brev=a letter 26 | kyckling=chicken 27 | middagen=The dinner 28 | middag=dinner 29 | apesin=orange 30 | ost=cheese 31 | frukt=fruit 32 | socker=sugar 33 | mat=food 34 | nötkött=beef 35 | jordgubbe=strawberry 36 | öl=beer 37 | fläskkött=pork 38 | olja=oil 39 | glass=ice cream 40 | måltid=meal 41 | glas=glass 42 | kocken=the cook 43 | tallrik=plate 44 | restaurangen=the restaurant 45 | gaffel=fork 46 | cup=kopp 47 | sked=spoon 48 | kniv=knife 49 | frukost=breakfast 50 | häst=horse 51 | hästen=the horse 52 | fågel=bird 53 | fågeln=the bird 54 | hund=dog 55 | anka=duck 56 | djur=animal 57 | djuret=the animal 58 | elefant=elephant 59 | krabba=crab 60 | sköldpadda=turtle 61 | spindel=spider 62 | ren=reindeer 63 | varg=wolf 64 | myra=ant 65 | mus=mouse 66 | teet=the tea 67 | ölet=the beer 68 | köttet=the meat 69 | vattnet=the water 70 | möss=mice 71 | flera=several 72 | vår=our 73 | våra=our/ours 74 | din=your/yours 75 | dina=your 76 | min=mine 77 | mitt=my 78 | deras=their/theirs 79 | hennes=her/hers 80 | hans=his 81 | dess=its 82 | Han äter sitt apple=He eats his apple 83 | sin=her/his/its/their (own) 84 | sina=their (own), his (own), one’s (own) 85 | era=your 86 | dem=them 87 | henne=her 88 | mig=me 89 | dig=you 90 | honom=him 91 | dem=them 92 | oss=us 93 | er=you 94 | den=the / it 95 | jacka=jacket 96 | jackor=jackets 97 | sweater=tröja 98 | sweaters=tröjor 99 | the sweaters=tröjorna 100 | skirt=kjol 101 | the skirts=kjolarna 102 | klänning=dress 103 | klänningen=the dress 104 | the shoes=skorna 105 | The women wear dresses=Kvinnorna har på sig klänningen 106 | kläder=clothes 107 | byxor=pants 108 | har på sig=is wearing / wears / wear 109 | kostymen=the suit 110 | kostymer=suits 111 | kostym=suit 112 | strumpor=socks 113 | skjorta=shirt 114 | halsduken=the scarf 115 | halsdukar=scarves 116 | knapp=button 117 | knappar=buttons 118 | skärp=belt 119 | slips=tie 120 | slipsen=the tie 121 | slipsarna=the ties 122 | fickor=pockets 123 | rock=coat 124 | handskar=gloves 125 | på=on 126 | ser=see 127 | hoppar=jump 128 | väljer=choose 129 | går=walk / go 130 | simmar=swim 131 | skriver=writes 132 | sjunger=sings 133 | kommer=coming 134 | säljer=sell 135 | åker=goes / is going / go 136 | lagar=cook (food) 137 | hör=hears 138 | springer=runs 139 | regnar=raining / rains 140 | sover=sleeps / is sleeping 141 | betalar=pay 142 | hittar=finds 143 | köper=buy 144 | arbetar=work (verb) 145 | ritar=draw 146 | vill=want 147 | have=ha 148 | are washing=tvättar 149 | are crying=gråter 150 | is playing=leker 151 | are using=använder 152 | is listening=lyssnar 153 | are laughing=skrattar 154 | is showing=visar 155 | det finns=there is / exist 156 | pratar=is talking 157 | flyger=fly 158 | står=are standing 159 | stöttar=support 160 | tar=takes 161 | rosa=pink 162 | svart=black 163 | vit / vita / vitt=white 164 | röd=red 165 | färger=colors 166 | gula=yellow 167 | blåa=blue 168 | färgglad=colorful 169 | gyllena=golden 170 | gröna=green 171 | brun=brown 172 | lila=purple 173 | grå=grey 174 | -------------------------------------------------------------------------------- /examples/icelandic.bcrds: -------------------------------------------------------------------------------- 1 | sítróna=lemon 2 | morgunmater=breakfast 3 | ostur=cheese 4 | sveppur=mushroom 5 | kjöt=meat 6 | súpa=soup 7 | skeið=spoon 8 | ávextir=fruit 9 | fiskur=fish 10 | hnífur=knife 11 | sykur=sugar 12 | gaffall=fork 13 | ég borða=I eat 14 | ég elda=I cook 15 | Talar þú ensku?=Do you speak English? 16 | takk fyrir=thank you 17 | vinsamlegast=please 18 | fyrirgefðu!=sorry! 19 | nei=no 20 | já=yes 21 | hæ=hi 22 | lokað=closed 23 | opið=open 24 | Reikninginn takk!=The bill, please! 25 | Hversu mikið?=How much? 26 | Get ég fengið vatn=I need water 27 | klósett=toilet 28 | veitingahús=restaurant 29 | Hjálp!=Help! 30 | Matseðil, takk!=Menu, please! 31 | Hversu mörg?=How many? 32 | Ekkert mál=No problem 33 | bless=bye 34 | þennan=that one 35 | Einn í viðbót=One more 36 | Einum minna=One less 37 | Vinsamlegast bíddu=Please wait 38 | herrar=gents (bathroom) 39 | dömur=ladies (bathroom) 40 | inngangur=entrance 41 | Hvar er matvöruverslunin?=Where is the supermarket? 42 | útgangur=exit 43 | hraðbanki=ATM machine 44 | sjúkrahús=hospital 45 | lögregla=police 46 | Ég er með ofnæmi fyrir jarðhnetum=I’m allergic to peanuts 47 | Ég er glaður=I am happy 48 | Skilurðu?=Do you understand? 49 | Of dýrt!=Too expensive! 50 | Eitthvað fleira?=Anything else? 51 | Nei, þetta er allt og sumt=No, that’s all 52 | einn=one 53 | tveir=two 54 | þrír=three 55 | fjórir=four 56 | fimm=five 57 | sex=six 58 | sjö=seven 59 | átta=eight 60 | níu=nine 61 | tíu=ten 62 | tuttugu=twenty 63 | þrjátíu=thirty 64 | fjörutíu=forty 65 | hundrað=hundred 66 | þúsund=thousand 67 | aðeins reiðufé=cash only 68 | aðgangur bannaður=do not enter 69 | Ég er týndur=I’m lost 70 | vinstri=left 71 | hægri=right 72 | Ég er veikur=I’m sick 73 | beint áfram=straight ahead 74 | Stöðva hér!=Stop here! 75 | Hvaðan ertu?=Where are you from? 76 | Ég er frá=I am from 77 | Hvað heitur þú?=What’s your name? 78 | Ég heiti Robert=My name is Robert 79 | Hvaðan ertu?=Where are you from? 80 | Afsakið!=Excuse me! 81 | Gjörðu svo vel!=You’re welcome! 82 | Gaman að kynnast þér!=Nice to meet you! 83 | Getur þú aðstoðað mig?=Can you help me? 84 | Gott kvöld=Good evening 85 | Góða nótt=Good night 86 | Hvernig hefur þú það?=How are you? 87 | Fínt, takk=Fine, thank you 88 | En þú?=And you? 89 | Hvernig er veðrið?=How’s the weather? 90 | Það er gott=It’s nice 91 | Það er slæmt=It’s bad 92 | Það er heitt=It’s hot 93 | Það er kalt=It’s cold 94 | Ég líka=Me too 95 | Það er ekkert=There aren’t any 96 | Ódýrari=A cheaper one 97 | Hversu mikið?=How much? 98 | helmingur=half 99 | Allt=All of it 100 | Get ég borgað með greiðslukorti=Can I pay with credit card? 101 | Eigið þið póstkort?=Do you have any postcards? 102 | Ég vil ekki=I don’t want 103 | Skrifaðu það niður=Write it down 104 | hleðslutæki=charger 105 | millistykki=adaptor 106 | kort í neðanjarðarlest=metro pass 107 | strætómiði=bus ticket 108 | lestarmiði=train ticket 109 | aðgöngumiði=entrance ticket 110 | regnhlíf=umbrella 111 | landakort=map 112 | bensín=gasoline 113 | minjagripir=souvenir 114 | sólgleraugu=sunglasses 115 | snyrtivörur=toiletries 116 | minniskort=memory card 117 | flöskuvatn=water bottle 118 | stigi=stairs 119 | Haltu þig frá!=Keep off! 120 | Ekki snerta!=Don’t touch! 121 | Farðu varlega!=Be careful! 122 | Gættu þín!=Watch out! 123 | Ég týndi veskinu mínu=I lost my wallet 124 | Má ég nota farsímann þinn?=Can I use your mobile? 125 | neyðarútgangur=emergency exit 126 | læknir=doctor 127 | sími=telephone 128 | flugvöllur=airport 129 | lestarstöð=train station 130 | neðanjarðarlestarstöð=metro station 131 | umferðarmiðstöð=bus station 132 | pósthús=post office 133 | markaður=market 134 | Hvad kallast þetta?=What’s this called? 135 | Hversu langt?=How far? 136 | Er það nálægt?=Is it near? 137 | Hvað er langt á flugvöllin?=How long to get to the airport? 138 | Til vinstri=To the left 139 | Til hægri=To the right 140 | Hægðu á þér!=Slow down! 141 | Fara klukkan hvað?=Leave at what time? 142 | í dag=today 143 | Getur þú tekið mynd af mér?=Can you take my photo? 144 | Má ég taka mynd af þér?=May I take your photo? 145 | grænmetisæta=vegetarian 146 | Með hverju mælir þú?=What do you recommend? 147 | ljúffengt=delicious 148 | Verði þér að góðu=Enjoy your meal 149 | Skál!=Cheers! 150 | -------------------------------------------------------------------------------- /nix/sources.nix: -------------------------------------------------------------------------------- 1 | # This file has been generated by Niv. 2 | 3 | let 4 | 5 | # 6 | # The fetchers. fetch_ fetches specs of type . 7 | # 8 | 9 | fetch_file = pkgs: spec: 10 | if spec.builtin or true then 11 | builtins_fetchurl { inherit (spec) url sha256; } 12 | else 13 | pkgs.fetchurl { inherit (spec) url sha256; }; 14 | 15 | fetch_tarball = pkgs: spec: 16 | if spec.builtin or true then 17 | builtins_fetchTarball { inherit (spec) url sha256; } 18 | else 19 | pkgs.fetchzip { inherit (spec) url sha256; }; 20 | 21 | fetch_git = spec: 22 | builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; 23 | 24 | fetch_builtin-tarball = spec: 25 | builtins.trace 26 | '' 27 | WARNING: 28 | The niv type "builtin-tarball" will soon be deprecated. You should 29 | instead use `builtin = true`. 30 | 31 | $ niv modify -a type=tarball -a builtin=true 32 | '' 33 | builtins_fetchTarball { inherit (spec) url sha256; }; 34 | 35 | fetch_builtin-url = spec: 36 | builtins.trace 37 | '' 38 | WARNING: 39 | The niv type "builtin-url" will soon be deprecated. You should 40 | instead use `builtin = true`. 41 | 42 | $ niv modify -a type=file -a builtin=true 43 | '' 44 | (builtins_fetchurl { inherit (spec) url sha256; }); 45 | 46 | # 47 | # Various helpers 48 | # 49 | 50 | # The set of packages used when specs are fetched using non-builtins. 51 | mkPkgs = sources: 52 | let 53 | sourcesNixpkgs = 54 | import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {}; 55 | hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; 56 | hasThisAsNixpkgsPath = == ./.; 57 | in 58 | if builtins.hasAttr "nixpkgs" sources 59 | then sourcesNixpkgs 60 | else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then 61 | import {} 62 | else 63 | abort 64 | '' 65 | Please specify either (through -I or NIX_PATH=nixpkgs=...) or 66 | add a package called "nixpkgs" to your sources.json. 67 | ''; 68 | 69 | # The actual fetching function. 70 | fetch = pkgs: name: spec: 71 | 72 | if ! builtins.hasAttr "type" spec then 73 | abort "ERROR: niv spec ${name} does not have a 'type' attribute" 74 | else if spec.type == "file" then fetch_file pkgs spec 75 | else if spec.type == "tarball" then fetch_tarball pkgs spec 76 | else if spec.type == "git" then fetch_git spec 77 | else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec 78 | else if spec.type == "builtin-url" then fetch_builtin-url spec 79 | else 80 | abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; 81 | 82 | # Ports of functions for older nix versions 83 | 84 | # a Nix version of mapAttrs if the built-in doesn't exist 85 | mapAttrs = builtins.mapAttrs or ( 86 | f: set: with builtins; 87 | listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) 88 | ); 89 | 90 | # fetchTarball version that is compatible between all the versions of Nix 91 | builtins_fetchTarball = { url, sha256 }@attrs: 92 | let 93 | inherit (builtins) lessThan nixVersion fetchTarball; 94 | in 95 | if lessThan nixVersion "1.12" then 96 | fetchTarball { inherit url; } 97 | else 98 | fetchTarball attrs; 99 | 100 | # fetchurl version that is compatible between all the versions of Nix 101 | builtins_fetchurl = { url, sha256 }@attrs: 102 | let 103 | inherit (builtins) lessThan nixVersion fetchurl; 104 | in 105 | if lessThan nixVersion "1.12" then 106 | fetchurl { inherit url; } 107 | else 108 | fetchurl attrs; 109 | 110 | # Create the final "sources" from the config 111 | mkSources = config: 112 | mapAttrs ( 113 | name: spec: 114 | if builtins.hasAttr "outPath" spec 115 | then abort 116 | "The values in sources.json should not have an 'outPath' attribute" 117 | else 118 | spec // { outPath = fetch config.pkgs name spec; } 119 | ) config.sources; 120 | 121 | # The "config" used by the fetchers 122 | mkConfig = 123 | { sourcesFile ? ./sources.json 124 | , sources ? builtins.fromJSON (builtins.readFile sourcesFile) 125 | , pkgs ? mkPkgs sources 126 | }: rec { 127 | # The sources, i.e. the attribute set of spec name to spec 128 | inherit sources; 129 | 130 | # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers 131 | inherit pkgs; 132 | }; 133 | in 134 | mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } 135 | -------------------------------------------------------------------------------- /bashcards: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o errtrace 5 | set -o nounset 6 | set -eou pipefail 7 | 8 | pname="bashcards" 9 | ext="bcrds" 10 | version="0.1.3" 11 | 12 | function version { 13 | echo "$version" 14 | return 0 15 | } 16 | 17 | function usage { 18 | cat < " opt 181 | 182 | # make sure the option is in 183 | # the list and then continue 184 | if 185 | [[ "$opt" =~ ^[0-9]+$ ]] && 186 | [ "$opt" -gt 0 ] && 187 | [ "$opt" -lt $((${#files[@]} + 1)) ] 188 | then 189 | local selected_file="${files[$opt-1]}" 190 | local -A cards 191 | 192 | while IFS="=" read -r key value; do 193 | cards["$key"]="$value" 194 | done < "$selected_file" 195 | 196 | run_cards "$selected_file" "$(declare -p cards)" 197 | else 198 | select_file "(Please select from the options)" "${files[@]}" 199 | fi 200 | 201 | return 0 202 | } 203 | 204 | function start { 205 | local -a files 206 | 207 | if [ -d "$1" ]; then 208 | for file in "$1"/*."$ext"; do 209 | files+=("$file") 210 | done 211 | 212 | select_file "" "${files[@]}" 213 | 214 | return 0 215 | else 216 | dir_not_found 217 | fi 218 | } 219 | 220 | # Check if no command is provided 221 | 222 | [[ $# -lt 1 ]] && unknown-cmd 223 | 224 | # Determine command 225 | 226 | case "$1" in 227 | -d|--dir ) [[ -z "${2-}" ]] && dir_not_found; start "$2";; 228 | -h|--help ) usage;; 229 | -v|--version) version;; 230 | *) unknown-cmd;; 231 | esac 232 | --------------------------------------------------------------------------------