Readit News logoReadit News
shoover commented on Using Git Offline   gibbard.me/using_git_offl... · Posted by u/l_nk
shoover · 2 years ago
Local clones and bundles are cool. I used to use hg bundle for one-off transport workflows back in the day.

An offline cheat sheet of those git commands comes in hand occasionally, too.

shoover commented on Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)   blog.burntsushi.net/ripgr... · Posted by u/subset
fhlu · 2 years ago
You can also add a small script to your WSL under `/usr/local/bin/git`:

  GIT_WINDOWS="/mnt/c/Program Files/Git/bin/git.exe"
  GIT_LINUX="/usr/bin/git"
  
  case "$(pwd -P)" in
  /mnt/?/*)
    case "$@" in
    # Needed to fix prompt, but it breaks things like paging, colours, etc
    rev-parse*)
      # running linux git for rev-parse seems faster, even without translating paths
      exec "$GIT_LINUX" "$@"
      ;;
    *)
      exec "$GIT_WINDOWS" -c color.ui=always "$@"
      ;;
    esac
    ;;
  *)
    exec "$GIT_LINUX" "$@"
    ;;
  esac

This allows you to use `git` in your WSL shell but it'll pick whichever executable is suitable for the filesystem that the repo is in :)

shoover · 2 years ago
Thank you. I will use this.
shoover commented on Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)   blog.burntsushi.net/ripgr... · Posted by u/subset
stinos · 2 years ago
It's fast indeed. And I can't help keeping promoting the combination with fzf :) For those who want to try it out, this is a Powershell function but the same principle applies in any shell. Does ripgrep then puts fuzzy searching in the resulting files+text on top while showing context in bat:

  function frg {
    $result = rg --ignore-case --color=always --line-number --no-heading @Args |
      fzf --ansi `
          --color 'hl:-1:underline,hl+:-1:underline:reverse' `
          --delimiter ':' `
          --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" `
          --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
    if ($result) {
      & ($env:EDITOR).Trim("`"'") $result.Split(': ')[0]
    }
  }
There are other ways to approach this, but for me this is a very fast way of nailing down 'I now something exists in this multi-repo project but don't know where exactly nor the exact name'

edit this comes out of https://github.com/junegunn/fzf/blob/master/ADVANCED.md and even though you might not want to use most of what is in there, it's still worth glancing over it to get ideas of what you could do with it

shoover · 2 years ago
Oh. Thanks for the tip. This might make me finally embrace powershell. I’ve been using WSL+zsh+fzf as a Windows CLI for continuity with day job Mac tools, but git CLI performance is only usable inside the WSL file system.
shoover commented on The Four Hobbies, and Apparent Expertise   brooker.co.za/blog/2023/0... · Posted by u/luu
doubled112 · 2 years ago
Oh yes! GAS is real, and seemingly endless. I'm getting better though.

I've had the same two electric guitars for about a decade now, and have no real urge to change them up.

The pedals though. I can't use an amp in the townhouse I'm in, so fell into the rabbit hole of ampless setups. Almost everything is just a new take on a 30-60 year old circuit though, or a model of the same.

I can't handle guitar modelling software. It seems like a really cheap way to go, but it's just endless futzing about. Not only do I need the gear, I need the PC to work too. Nope.

I think somebody once said that this entire industry would fall apart if everybody just learned to use an EQ, and I have to say it feels really accurate. I think I'm almost "done" with gear though, and I can feel my playing getting better as a result.

shoover · 2 years ago
Happy to note after a couple years using S-Gear that I tinker with it less than I expected and haven't been seriously tempted to buy an amp. I think having the option to try all the presets is satisfying enough, whereas with amps I would always wonder if just one more pedal purchase would find the magic tone. I still need more guitars, though.
shoover commented on Mastodon 3.2   blog.joinmastodon.org/202... · Posted by u/jrepinc
danielheath · 5 years ago
It’s a rails app. I love rails (and activitypub), and I use rails for work frequently, but it comes with substantial operational load (postgres, redis, worker nodes, process supervision, media storage, backups, high ram use, etc).

If that doesn’t scare you off, then go for it!

If you don’t want the federation, I’d suggest looking for something lighter.

shoover · 5 years ago
It’s a little heavy, but I can say it runs fine in a 1 GB VPS, with the addition of a 1 GB swap file to compile the front end during installation and upgrade.
shoover commented on Mastodon 3.2   blog.joinmastodon.org/202... · Posted by u/jrepinc
wronglebowski · 5 years ago
If I just wanted to host my own instance for my family to post news and updates on would that be a suitable use case for Mastodon?

I realize it can be federated, but just a singular isolated FB/Twitter clone would be ideal.

shoover · 5 years ago
Yep. There are even settings to require a login to view any content, designed for private instances such as for classrooms, which effectively locks down the instance. That’s how I use it for my family.
shoover commented on Reasons to Quit Twitter and Facebook and Switch to Mastodon   finertech.com/2019/03/21/... · Posted by u/yogthos
shoover · 6 years ago
I set up a private Mastodon server for my family several weeks ago and we're loving it. It's a mighty impressive Rails/React app, very well designed and implemented. I have a few minor UI quibbles based on experience with twitter, but the design is really good, responsive, and snappy.

The kids run Fedilab on hand-me-down, wifi-only Android phones and just go to town with emojis, gifs, and photos. The parents share more of their days with the kids rather than only texting each other.

The setup guide is great--I followed it on a 1GB Vultr VPS and was up and running easily, except for one maddening hurdle, which is that on 1GB server you do need a swap file to successfully precompile JS assets. See [1] for the workaround. I guess this is just normal in 2019. Otherwise all the services run fine with 1GB once compiled.

I wish it supported locking down public posts at the admin level, but that's just my use case. The login system blocks most access, and public posts can be blocked with nginx authentication and tweaking the list of streams flagged public in the streaming service.

[1] https://github.com/tootsuite/mastodon/issues/5836#issuecomme...

shoover · 6 years ago
Ah, they have a card in progress for a one-click Digital Ocean install [1]. Fantastic! This is an incredible open source project to watch, not your typical library or system service, but a real, polished app.

Polls functionality is in master, just waiting for release. My kids are going to love this.

[1] - https://github.com/tootsuite/mastodon/projects/8#card-185452...

shoover commented on Reasons to Quit Twitter and Facebook and Switch to Mastodon   finertech.com/2019/03/21/... · Posted by u/yogthos
shoover · 6 years ago
I set up a private Mastodon server for my family several weeks ago and we're loving it. It's a mighty impressive Rails/React app, very well designed and implemented. I have a few minor UI quibbles based on experience with twitter, but the design is really good, responsive, and snappy.

The kids run Fedilab on hand-me-down, wifi-only Android phones and just go to town with emojis, gifs, and photos. The parents share more of their days with the kids rather than only texting each other.

The setup guide is great--I followed it on a 1GB Vultr VPS and was up and running easily, except for one maddening hurdle, which is that on 1GB server you do need a swap file to successfully precompile JS assets. See [1] for the workaround. I guess this is just normal in 2019. Otherwise all the services run fine with 1GB once compiled.

I wish it supported locking down public posts at the admin level, but that's just my use case. The login system blocks most access, and public posts can be blocked with nginx authentication and tweaking the list of streams flagged public in the streaming service.

[1] https://github.com/tootsuite/mastodon/issues/5836#issuecomme...

shoover commented on Pretty PuTTY – Better PuTTY Settings   github.com/jacktrocinski/... · Posted by u/JacKTrocinskI
shoover · 6 years ago
I spent some time recently cleaning up my Putty sessions. My goal was to control all colors in the Putty settings and have everything look good with tmux, bash, and emacs out of the box. The result was basically what the OP arrived at. It works well as long as the Putty and tmux terminal types match (e.g. putty-256color and tmux-256color, respectively) with the exception of emacs isearch highlighting, which has bad contrasting defaults that also obscure the foreground text of the current match (why do we even bother with cyan and magenta?).

Here's a Ruby script that may be of use to paint over existing sessions using various color schemes gathered from around github and translated to Ruby data. https://gist.github.com/shoover/40a35c07a32de16af9b2f79ca933...

shoover commented on Vim Is Saving Me Hours of Work When Writing Books and Courses   nickjanetakis.com/blog/vi... · Posted by u/nickjj
TeMPOraL · 7 years ago
I use proper org-mode functions to query the built-in agenda and then group entries by org-mode tags. My code expects a configuration that maps tags to their line item names (as on invoice), hourly rates and applicable tax. I use this to output a dynamic[0] table like this:

   | Tag             | Invoice line name     | Hours |  Rate |    Net | VAT % | VAT amount |  Total |
   |-----------------+-----------------------+-------+-------+--------+-------+------------+--------|
   | meeting         | Meetings              |    10 | 12.00 | 120.00 | NP    |       0.00 | 120.00 |
   | procrastinating | Important tasks       |    20 | 13.00 | 260.00 | NP    |       0.00 | 260.00 |
   | hn              | Other important tasks |    40 | 14.00 | 560.00 | NP    |       0.00 | 560.00 |
   | coding          | Occasional code       |     3 | 15.00 |  45.00 | NP    |       0.00 |  45.00 |
   |-----------------+-----------------------+-------+-------+--------+-------+------------+--------|
   | Totals          | -                     |    73 |     - | 985.00 | -     |       0.00 | 985.00 |
   #+TBLFM: @>$3=vsum(@2..@-1)::@>$5=vsum(@2..@-1);%.2f::@>$7=vsum(@2..@-1);%.2f::@>$8=vsum(@2..@-1);%.2f::$5=$3*$4;%.2f::$7=if(typeof($6) < 10, $5*$6, 0);%.2f::$8=$7+$5;%.2f
The #+TBLFM: line at the bottom is org-mode spreadsheet functionality; it ensures I can modify the table text in-place, and just press C-c C-c to recalculate all values in it. I generate a similar table with data for invoices; some taken from my configuration, some computed (e.g. invoice number is generated by looking at filenames of previous invoices; sale date and service period are estimated from current date and the time range you specified when generating line items table, etc.).

The code for generating above table is hand-crafted. While org-mode provides you a generator for agenda tables based on TODO item name - see [1], I had to write similar feature that aggregated time by org-mode tags. I used [2] as a reference, but essentially wrote my own implementation. Surprisingly, it turned out to be almost trivial.

Then, it's simply a matter of turning those two org-mode tables into an elisp list of keys and values. This I accomplish using a simple elisp that uses built-in Emacs calls:

  (defun trc-invoicing--named-table-to-lisp (name)
    "Convert a named org mode table in the current buffer into a list.
  The function finds a table named `NAME', passes it through `ORG-TABLE-TO-LISP',
  and return the result. Refer to the documentation of `ORG-TABLE-TO-LISP'
  for info about result's shape."
    (save-excursion
      (goto-char (point-min))
      (search-forward (format "#+NAME: %s" name))
      (forward-line)
      (org-table-to-lisp)))
Then it's a matter of populating a LaTeX template with extracted values, invoking pdflatex, and copying the resulting PDF in an appropriate place. That last part I yet have to finish.

It's the biggest piece of elisp I wrote since Nyan Mode, but all in all, I find it surprisingly easy to code for Emacs. Availability of source code, extensive in-editor documentation and built-in source-level debugger make this process pretty pleasant.

--

[0] - Org Mode has a concept of "dynamic blocks". You type in #+BEGIN: blockname some params, and then using C-c C-c on it causes Org Mode to invoke an elisp function named org-dblock-write:blockname. The called function is then responsible for outputting contents of the dynamic block.

[1] - http://orgmode.org/manual/The-clock-table.html

[2] - https://gist.github.com/tsu-nera/d9ffa6a51a6e7bdb957b

shoover · 7 years ago
Very nice, thanks for the tutorial. I see that TBLFM saves some coding vs. the gist in [2].

u/shoover

KarmaCake day610February 5, 2009
About
Shawn Hoover Software engineering, energy data
View Original