In the middle of the desert you can say anything you want
I give all my doctoral students a copy of the following great paper (and I’ve used a variant of the check list at the end for years - avoids errors when working on multiple papers with multiple international teams in parallel) http://www-mech.eng.cam.ac.uk/mmd/ashby-paper-V6.pdf
I’ll write here the main points from each of the linked PDF, copyright belongs to the original authors ofc.
How to Write a Paper
Mike Ashby
Engineering Department, University of Cambridge, Cambridge
6 rd Edition, April 2005
This brief manual gives guidance in writing a paper about your research. Most of the advice applies equally to your thesis or to writing a research proposal.
This is based on 2016 version of the paper, more are here: https://news.ycombinator.com/item?id=38446418#38449638 with the link to the 2016 version being https://web.archive.org/web/20220615001635/http://blizzard.cs.uwaterloo.ca/keshav/home/Papers/data/07/paper-reading.pdf
When you can’t write, it is because you don’t know what you want to say. The first job is to structure your thinking.
Don’t yet think of style, neatness or anything else. Just add, at the appropriate place on the sheet, your thoughts.
[continued on p. 62]
, [see footnote]
.Avoid clichés (standard formalised phrases): they are corpses devoid of the vitality which makes meaning spring from the page
How to Read a Paper
S. Keshav
David R. Cheriton School of Computer Science, University of Waterloo
Waterloo, ON, Canada
keshav@uwaterloo.ca
http://ccr.sigcomm.org/online/files/p83-keshavA.pdf
I have a pytest of a function that uses python @lru_cache
:
cacheinfo = gbif_get_taxonomy_id.cache_info()
assert cacheinfo.hits == 1
assert cacheinfo.misses == 2
LRU cache gets preserved among test runs, breaking independence and making such bits fail.
Enter pytest-antilru · PyPI which resets the LRU cache between test runs. Installing it as a python package is all there’s to ite.
Needed argparse to accept yes/no decisions, should have been used inside a dockerfile that doesn’t have if/else logic, and all solutions except getting a parameter that accepts string like true/false seemed ugly.
The standard linux --do-thing
and --no-do-thing
were also impossible to do within Docker, if I want to use an env. variable etc., unless I literally set them to --do-thing
which is a mess for many reasons.
I had 40 tabs open because apparently this is not a solved problem, and all ideas I had felt ugly.
How do I convert strings to bools in a good way? (bool
alone is not an option because bool('False')
etc.)
Basic if value=="true"
would work, but maybe let’s support other things as a bonus because why not.
My first thought was to see what YAML does, but then I found the deprecated in 3.12 distutils.util.strtobool
: 9. API Reference — Python 3.9.17 documentation
It converts y,yes,t,true,on,1 / n,no,f,false,off,0 into boolean True
/False
.
The code, the only reason it’s a separate function (and not a lambda inside the type=
parameter) was because I wanted a custom ValueError and to add the warning for deprecation, as if Python would let me forget. An one-liner was absolutely possible here as well.
def _str_to_bool(x: str):
"""Converts value to a boolean.
Currently uses (the rules from) distutils.util.strtobool:
(https://docs.python.org/3.9/distutils/apiref.html#distutils.util.strtobool)
True values are y, yes, t, true, on and 1
False values are n, no, f, false, off and 0
ValueError otherwise.
! distutils.util.strtobool is deprecated in python 3.12
TODO solve it differently by then
Args:
value (str): value
"""
try:
res = bool(strtobool(str(x).strip()))
except ValueError as e:
logger.error(
f"Invalid str-to-bool value '{x}'. Valid values are: y,yes,t,true,on,1 / n,no,f,false,off,0."
)
raise e
return res
# inside argparse
parser.add_argument(
"--skip-cert-check",
help="Whether to skip a cert check (%(default)s)",
type=_str_to_bool,
default=SKIP_CERT_CHECK,
)
This allows:
--no-do-thing
flagsdistutils
is deprecated in 3.12 though :(
YAML is known for it’s bool handling: Boolean Language-Independent Type for YAML™ Version 1.1.
Regexp:
y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF`
I don’t like it and think it creates more issues than it solves, e.g. the “Norway problem” (211020-1304 YAML Norway issues), but for CLI I think that’s okay enough.
Using Kubernetes envFrom for environment variables describes how to get env variables from config map or secret, copying here:
#####################
### deployment.yml
#####################
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
selector:
matchLabels:
app: mans-not-hot
template:
metadata:
labels:
app: mans-not-hot
spec:
containers:
- name: app
image: gcr.io/mans-not-hot/app:bed1f9d4
imagePullPolicy: Always
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: env-configmap
- secretRef:
name: env-secrets
#####################
### env-configmap.yml
#####################
# Use config map for not-secret configuration data
apiVersion: v1
kind: ConfigMap
metadata:
name: env-configmap
data:
APP_NAME: Mans Not Hot
APP_ENV: production
#####################
### env-secrets.yml
#####################
# Use secrets for things which are actually secret like API keys, credentials, etc
# Base64 encode the values stored in a Kubernetes Secret: $ pbpaste | base64 | pbcopy
# The --decode flag is convenient: $ pbpaste | base64 --decode
apiVersion: v1
kind: Secret
metadata:
name: env-secrets
type: Opaque
data:
DB_PASSWORD: cDZbUGVXeU5e0ZW
REDIS_PASSWORD: AAZbUGVXeU5e0ZB
@caiquecastro
This is neater than what I used before, listing literally all of them:
spec:
containers:
- name: name
image: image
env:
- name: BUCKET_NAME
valueFrom:
configMapKeyRef:
name: some-config
key: BUCKET_NAME
Wanted to do coloring and remembered about Krita and the tutorial about flat coloring (Flat Coloring — Krita Manual 5.2.0 documentation) mentioned the Colorize Mask and it’s awesome!
Needed to actually understand it, and even had to watch a video tutorial (Tutorial: Coloring with “Colorize-mask” in Krita - YouTube) but it was so worth it!
It’s basically a bucket fill tool on steroids, and even might be reason enough to move away from Inkscape for some of these tasks!
Cleaned lineart:
Mask (red is transparent):
Result:
Result with random brushes moon texture below it:
Interesting bits:
Multiply
, but if there’s anything else below it it’ll be a mess - sometimes it should just be converted to a paint layer w/ the correct settings to see what it will look like in the endHeard the expression “roter Faden”, googled it, and it’s actually interesting and relevant.
In a scientific context, it’s the main topic / leitmotiv / … of the text. You ask a question, and all parts of the text should work together to answer it, relating to it in a clear way.
Excellent (PDF) link on this exact topic in scientific writing & an itemized list of ways to make it clear: https://www.uni-osnabrueck.de/fileadmin/documents/public/1_universitaet/1.3_organisation/sprachenzentrum/schreibwerkstatt/Roter_Faden_Endversion.pdf
TODO hypothetically save it from link rot somewhere
Also:
wolph/python-progressbar: Progressbar 2 - A progress bar for Python 2 and Python 3 - “pip install progressbar2” really cool flexible progressbar.
Also: progressbar.widgets — Progress Bar 4.3b.0 documentation:
Examples of markers:
- Smooth: ` ▏▎▍▌▋▊▉█` (default)
- Bar: ` ▁▂▃▄▅▆▇█`
- Snake: ` ▖▌▛█`
- Fade in: ` ░▒▓█`
- Dots: ` ⡀⡄⡆⡇⣇⣧⣷⣿`
- Growing circles: ` .oO`
You can export your own papers as single file and the entire Internet tells you how. But if you’re NOT the author, this is a workaround I found:
Github: simonw/llm: Access large language models from the command-line
The example from the tweet:
git log | head -n 200 | llm -s "Of the most recent 5 commits, which is probably the most important? I use 'Minor' and similar commit messages to mark unimportant commits."
llm
on pypy
I’ll restart https://serhii.net/links later, and this will be the first bit I’ll add there:
TL;DR comedians are associated with depression/anxiety:
Humour has been shown to develop from a young age, fostered by parental behaviour. A parent’s immature nature can lead to additional responsibilities forced onto children, which can evoke issues of self-worth and a need for acceptance. The constant search for approval may cause mental health issues such as anxiety or depression […] Laughter can evolve as a medium for self-preservation, detaching the individual from any adversity faced allowing for perceived control over uncomfortable situations.
Sad clown paradox is characterised by a cyclothymic temperament, which encourages the creation of light-hearted humour in a professional setting, despite inner turmoil.