In the middle of the desert you can say anything you want
I should really try this sometime. Having a reproducible OS install would make life much easier. On my radar a long time, but a person I was interviewing last week was the final drop I guess.
bindsym ${mod}+d exec ${nixpkgs.rofi}/bin/rofi -show run
Nix is a 100% reproducible package manager, for all languages and all things. This means your python environment, your R environment, your models, your entire computer can be completely reproduced, all using the magic of nix. In this article, we will walk through setting up a simple, reproducible, and failproof data science stack with nix, including importing packages not found on nixpkgs and caching the builds online
From SO, to find the disk space taken by files with a certain extension/type:1
find ./photos/john_doe -type f -name '*.jpg' -exec du -ch {} + | grep total$
An incredibly clear explanation, copypasted from StackOverflow, about the flavours of git reset --xxx HEAD~1
In the simplest terms:
--soft: uncommit changes, changes are left staged (index).--mixed (default): uncommit + unstage changes, changes are left in working tree.--hard: uncommit + unstage + delete changes, nothing left.A @classmethod gets the class as first parameter, nice for constructors/factories etc. A @staticmethod doesn’t know anything about the class at all, and the only use it has is to put functions that logically belong to the class inside the class. 1
Additionally,
Contains books / resources about ML, from foundations to roadmaps / learning paths , “channels” (sites that regularly publish ML content), etc.
Really really impressive.
Yaml 1.1 interprets the following strings as booleans, if unquoted: 1
y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF
Related + YAML hate:
.. is probably my new obsession, along with getting it to play nicely with Hugo. It’s a closed non-open-source system but files are saved as markdown, has an awesome Android app - everything I’ve ever wanted except openness, basically.
So:
Templater1 is a community plugin for template stuff, but supports neat things like getting clipboard data, creating files, etc. Additionally supports automatically using templates when creating notes in a folder or in general and a lot of other excellent stuff.
This template gets run manually after I create and name a note. When I run it, it autogenerates Hugo front matter, gets the title from the filename, and puts the cursor in the first tag. The second tag is created from the folder name where the note is located, currently I defined two: it and rl.
---
title: "<% tp.file.title %>"
tags:
- "zc"
- "zc/<% tp.file.folder() %>"
- "<% tp.file.cursor() %>"
fulldate: <% tp.date.now("YYYY-MM-DDTHH:MM:SSZZ") %>
date: <% tp.date.now("YYYY-MM-DD") %>
hidden: false
draft: true
---
I looked at zoni/obsidian-export: Rust library and CLI to export an Obsidian vault to regular Markdown and khalednassar/obyde: A minimal tool to convert a standardly configured Obsidian vault to a Jekyll or Hugo blog., found the latter to be a bit clearer in how it handles assets etc. It requires a date in frontmatter in YYYY-MM-DD format, which I provided.
round() has weirdly unexpected behaviour that I’m ashamed I didn’t notice or know about:
if two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5) and round(-0.5) are 0, and round(1.5) is 2) 1
So:
>>> round(1.5)
2
>>> round(2.5)
2
>>> round(3.5)
4
math.isclose() to check for “almost equal”Had an issue with checking whether a sum of floats sums up to a number, remembering that python floats are ‘special’:
>>> 0.1 + 0.2
0.30000000000000004
Stack overflow1 told me about math.isclose(), works as you’d expect:
assert math.isclose(sum(floats), needed_sum)
From unittest documentation 1
class MyTestCase(unittest.TestCase):
@unittest.skipIf(mylib.__version__ < (1, 3), "not supported in this library version")
def test_format(self):
# Tests that work for only a certain version of the library.
pass