User
Write something
Exclusive Skool Content: A Few Ledger Aliases
Hello. Today, I am going to discuss the details of a few aliases I made for the Ledger command line program on Linux. Since Mint had closed down, I was searching for a new budgeting app, and Ledger fits the bill nicely. If you're not familiar with Ledger, it is a budgeting app that utilizes a plaintext "budget.dat" file to summarize and display various details about your spending habits. It uses double-entry accounting, which means that each Ledger entry must sum up to 0. If there is a credit on one side of the equation, there must be a debit on the other side. For more information, check out the Ledger documentation here: https://ledger-cli.org/doc/ledger3.html Once you understand the basics, there are a few aliases you can add to your ~/.zshrc that summarize various items in your budget. Here are mine: alias lbal='ledger -f <your_budget.dat_file> balance \^assets \^liabilities' alias lbie='ledger -f <your_budget.dat_file> balance \^income \^expenses' alias lref='ledger -M register -f <your_budget.dat_file> expenses:food' Of course, you can set up any alias you like for the last one, including one for assets:checking, income, or even liabilities:credit cards. The world is your oyster! Hope this was useful to you. Feel free to add your own!
0
0
My 10 Most Used Command Line Commands
Today, I am going to be sharing with you my top 10 command line commands. First, here’s how I discovered my Top 10: $ history | awk ‘{print $2}’ | sort | uniq -c | sort -n | tail -10 (We need two sorts because uniq only works the way we want it to on sorted lists.) And, without further ado, here are my Top 10: 10. nv An alias for neovim. I used this command 147 times. Surprising, because I am mainly an Emacs user. However, since I generally only open Emacs once per session, it doesn’t show up on this list of commands. 9. gc An alias for git commit -m . I used this command 161 times. 8. iex The Elixir interpreter. I used this command 179 times. 7. rm Used to remove files. I used this command 182 times. 6. git Self explanatory, but still weird once you see what my #1 is. I used this command 203 times. 5. brew The MacOS package manager. I used this command 224 times. 4. mix The Elixir tool. I used this command 250 times. 3. l An alias for ls -lah . I used this command 278 times. 2. cd Used to change directories. I used this command 579 times. 1. g An alias for git (now you see why it’s strange that I also have the unaliased version on this list). I used this command 1173 times. And that’s it. What are your Top 10? Update: A first-of-many Skool exclusive! Since writing this article, a new contender in my top 10 has arrived! It is: dr Which is my alias for "docker". I also added an alias "m" for "mix", but that hasn't been used as much as needed to show up in my top 10. Yet!
0
0
emacsclient and fzf
I recently came across Andrew Quinn’s article on fzf: https://andrew-quinn.me/fzf/ I just thought I’d add that, you can open up a fzf-inded file in `emacsclient` by typing into your terminal `ec <C-t>` Of course, you will need to have emacsclient aliased to ec: `alias ec='emacsclient'`. Useful!
0
0
Debugging Elixir
Hello. Today, I am going to show you how to effectively debug an Elixir program using dbg and pry. To get started, first run: $ git clone https://github.com/danieljaouen/codewars_problem.git If you look at lib/codewars_problem.ex, you will notice two dbg statements located within the file. dbg is used to stop execution of your code when combined with the invocation of iex --dbg pry. Let’s try it out: $ iex --dbg pry lib/codewars_problem.ex iex(1)> CodewarsProblem.solution(“AABBCCAABB") Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] Interactive Elixir (1.15.4) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> CodewarsProblem.solution("AABBCCAABB") Break reached: CodewarsProblem.solution/1 (lib/codewars_problem.ex:31) 28: prev = fetch(table, "prev") 29: result = fetch(table, "result") 30: 31: dbg([item, prev, result]) 32: 33: if prev != item do 34: :ets.insert(table, {"prev", item}) iex(2)> We’ve hit our first instance of dbg! Here, we can do whatever we like at the point of the dbg, including inspect variables: iex(2)> item 65 iex(3)> prev "" iex(4)> result [] iex(5)> Now, type continue. You will be greeted with the printing of the updated variables from before: iex(5)> continue [item, prev, result] #=> [65, "", []] Break reached: CodewarsProblem.solution/1 (lib/codewars_problem.ex:31) 28: prev = fetch(table, "prev") 29: result = fetch(table, "result") 30: 31: dbg([item, prev, result]) 32: 33: if prev != item do 34: :ets.insert(table, {"prev", item}) iex(6)> Here, you can again print out variables you are interested in. Hit up to scroll back to your last continue. Keep entering continue until the program completes. If you scroll back up to the printed variables, you will notice result taking shape, but backwards. This is by design, as prepending to a linked list is less costly than appending. Of course, we then need to remember to Enum.reverse the list at the end, which we do.
0
0
Welcome to Programming Masterminds!
THE place to learn about and grow your programming skills! Topics will include Python, Elixir, Emacs, Vim, Linux, hosting, and more. Please enjoy your stay!
0
0
1-5 of 5
A gathering place for all programmers, novice and expert alike.
powered by
This group has been archived