In the middle of the desert you can say anything you want
title: “211121-2123 Undoing git add / unstaging files” tags:
Two different questions here! Both options are: 1
If you add a file for the first time, git rm --cached .
or git -rm -r --cached .
will reverse that.
If you want to un-add changes to a file that’s already in the repo, git reset <file>
/ git reset
will undo that.
(heard at work)
The basic concept of mob programming is simple: the entire team works as a team together on one task at the time. That is: one team – one (active) keyboard – one screen (projector of course).
— Marcus Hammarberg, Mob programming – Full Team, Full Throttle1
“”Mob programming is a software development approach where the whole team works on the same thing, at the same time, in the same space, and at the same computer. “Mob code review is a software development approach where the whole team reviews on the same thing, at the same time, in the same space, and at the same computer.”2
Python’s NamedTuple is really cool!
Python’s Instance, Class, and Static Methods Demystified – Real Python is an excellent guide, as is the entire website.
NamedTuple VS Dataclass, copying from SO answer:[^1]
When your data structure needs to/can be immutable, hashable, iterable, unpackable, comparable then you can use NamedTuple
. If you need something more complicated, for example, a possibility of inheritance for your data structure then use Dataclass
.
The immutable part is important - can’t do named_tuple.value = 3
after creating it.
Can be created also through colections.namedtuple
, copied directly from :
>>> from collections import namedtuple
>>> Person = namedtuple("Person", "name children")
>>> john = Person("John Doe", ["Timmy", "Jimmy"])
>>> john
Person(name='John Doe', children=['Timmy', 'Jimmy'])
>>> id(john.children)
139695902374144
whatever: List[str,str,str]
can’t be done, because lists inherently change sizeTIL df -h filename
(or more likely df -h .
) returns the info about the filesystem that file is in. Will save me a lot of time, since usually that’s exactly teh one I need.
Story behind this:
Mistyped df -h
as df -
, it returned:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root 488960032 463006852 1045612 100% /
Wanted to find out what happened. Likely this:
-
in zsh is the last directory you were in (since cd -
does gets you there)man df
says that:
df displays the amount of disk space
available on the file system containing each file name argument. If no file name is given,
the space available on all currently mounted file systems is shown.
Added this to ~/.zshrc
, since I seem to type it so often to have memorized it:
alias dus="du -hd1 | sort -h"
Returns the sizes of dirs sorted by size:
32K ./configs
5,2M ./small_dataset
24M ./conversion
630M ./model
792M .
I should make use more often of the fact that @staticmethod
and @classmethod
methods can be called as self.mystaticorclassmethod()
in the “standard” methods.
(Another installment of “I should use tree
more”)
The running tests window has options, like “select first failed test on completion” and “scroll to end”.
Pycharm / intellij idea have an action called “Reopen closed tab”. Set it to <C-S-T>
a la Chrome, works nicely!
There’s also a default <C-A-left>
shortcut for last cursor location1 that does the same.
My current keymap looks like this:
<keymap version="1" name="XWin copy" parent="Default for XWin">
<action id="ActivateCommitToolWindow">
<keyboard-shortcut first-keystroke="shift alt 3" />
</action>
<action id="ActivateDebugToolWindow">
<keyboard-shortcut first-keystroke="shift alt 2" />
</action>
<action id="ActivateFavoritesToolWindow" />
<action id="ActivateFindToolWindow" />
<action id="ActivateMessagesToolWindow" />
<action id="ActivateProblemsViewToolWindow">
<keyboard-shortcut first-keystroke="shift alt 4" />
</action>
<action id="ActivateProjectToolWindow">
<keyboard-shortcut first-keystroke="shift alt 1" />
</action>
<action id="ActivateRunToolWindow" />
<action id="ActivateServicesToolWindow" />
<action id="ActivateStructureToolWindow" />
<action id="ActivateTODOToolWindow">
<keyboard-shortcut first-keystroke="shift alt 5" />
</action>
<action id="ActivateVersionControlToolWindow" />
<action id="CheckinProject">
<keyboard-shortcut first-keystroke="ctrl k" />
<keyboard-shortcut first-keystroke="ctrl alt c" />
</action>
<action id="DuplicatesForm.SendToLeft" />
<action id="DuplicatesForm.SendToRight" />
<action id="EditorDown">
<keyboard-shortcut first-keystroke="down" />
<keyboard-shortcut first-keystroke="altGraph t" />
</action>
<action id="FileChooser.GotoHome" />
<action id="FileChooser.GotoModule" />
<action id="FileChooser.GotoProject" />
<action id="FindNext">
<keyboard-shortcut first-keystroke="f3" />
</action>
<action id="GotoTest" />
<action id="IntroduceConstant" />
<action id="MoveEditorToOppositeTabGroup">
<keyboard-shortcut first-keystroke="ctrl alt l" />
</action>
<action id="NextSplitter">
<keyboard-shortcut first-keystroke="ctrl l" />
</action>
<action id="PrevSplitter">
<keyboard-shortcut first-keystroke="ctrl h" />
</action>
<action id="ReformatCode" />
<action id="ReopenClosedTab">
<keyboard-shortcut first-keystroke="shift ctrl t" />
</action>
<action id="ServiceView.ShowServices" />
<action id="Switch To Last Tab">
<keyboard-shortcut first-keystroke="alt period" />
<keyboard-shortcut first-keystroke="alt 0" />
</action>
<action id="Switch To Tab #1">
<keyboard-shortcut first-keystroke="alt 1" />
</action>
<action id="Switch To Tab #10">
<keyboard-shortcut first-keystroke="alt 0" />
</action>
<action id="Switch To Tab #2">
<keyboard-shortcut first-keystroke="alt 2" />
</action>
<action id="Switch To Tab #3">
<keyboard-shortcut first-keystroke="alt 3" />
</action>
<action id="Switch To Tab #4">
<keyboard-shortcut first-keystroke="alt 4" />
</action>
<action id="Switch To Tab #5">
<keyboard-shortcut first-keystroke="alt 5" />
</action>
<action id="Switch To Tab #6">
<keyboard-shortcut first-keystroke="alt 6" />
</action>
<action id="Switch To Tab #7">
<keyboard-shortcut first-keystroke="alt 7" />
</action>
<action id="Switch To Tab #8">
<keyboard-shortcut first-keystroke="alt 8" />
</action>
<action id="Switch To Tab #9">
<keyboard-shortcut first-keystroke="alt 9" />
</action>
<action id="TodoViewGroupByFlattenPackage" />
<action id="TypeHierarchy" />
<action id="TypeHierarchyBase.BaseOnThisType" />
<action id="Vcs.Log.FocusTextFilter" />
<action id="Vcs.ReformatCommitMessage" />
<action id="com.mikejhill.intellij.movetab.actions.MoveTabLeft">
<keyboard-shortcut first-keystroke="shift ctrl page_up" />
<keyboard-shortcut first-keystroke="ctrl comma" />
</action>
</keymap>
Added “Obsidian footnotes1” plugin, bound it to <C-R>
, adds numbered footnotes. Emulates my old vim footnote macro, except that footnotes are numbered and therefore automatic.
Ideally (for the master page, hypotetical merging of markdown files) I’d allow for non-automatic ones as I had in vim (I type whatever
, press the footnote shorcut, creates a footnote with index whatever
) and this would be a nice case for a simple obsidian template but I won’t be doing it in the near term.