Loess.ru

having fun

История IP

Весьма занятное, я бы даже сказал — фундаментальное чтиво (The world in which IPv6 was a good design): https://apenwarr.ca/log/20170810 (pdf)

Anyway, I digress. The salient detail here is that unlike real IP services, bootp and DHCP need to know about ethernet addresses, because after all, it’s their job to hear your ethernet address and assign you an IP address to go with it. They’re basically the reverse of ARP, except we can’t say that, because there’s a protocol called RARP that is literally the reverse of ARP. Actually, RARP worked quite fine and did the same thing as bootp and DHCP while being much simpler, but we don’t talk about that.

И небольшое ревью спустя три года, не менее фундаментальное, чем предыдущая статья (IPv4, IPv6, and a sudden change in attitude): https://apenwarr.ca/log/20200708 (pdf)

И немного рекламы после ревью: Tailscale+WireGuard. Авторы в этих сервисах видят решение основной нерешённой проблемы ipv6 — коннективити при смене ip-адреса:

IP mobility is what we do, in a small way, with Tailscale’s WireGuard connections. We try all your Internet links, IPv4 and IPv6, UDP and TCP, relayed and peer-to-peer. We made mobile IP a real thing, if only on your private network for now. And what do you know, the math works. Tailscale’s use of WireGuard with two networks is more reliable than with one network.

Also: hilbert map of IPv4 address space, same for IPv6

3d-printed parts annealing


https://blog.prusaprinters.org/how-to-improve-your-3d-prints-with-annealing_31088/ (pdf)
https://www.qbed.space/knowledge/blog/annealing-pla

Long story short:

Sadly, we found out that the level of warping makes both materials completely unusable for such parts with complicated shapes and relatively precise dimensions

What is annealing good for, then? It does its job with simple parts, which need to improve their mechanical durability and tensile strength. As an example, we annealed simple hooks, which could use some more tensile strength. We printed them from PLA and annealed at 90 °C (194 °F) for 30 minutes. Another example is two PETG prints: a cupboard handle and a simple measuring cup, again, annealed at 110 °C (230 °F) for 30 minutes.

Some ways for organizing linux desktops/workflows/terminals

Прекрасная статья-обзор организации процесса в текстовых терминалах в терминальной стадии: http://jacobzelko.com/workflow/ (pdf)


Таскбар в screen делается записью в ~/.screenrc, что-то типа:
hardstatus alwayslastline "%{bw}[%H] [%?%-Lw%?%{wb}%n*%f %t%{bw}%?%+Lw%?]%=%{bw} [%1`] [%c:%s] [%l]"
http://www.softpanorama.org/Utilities/Screen/tips.shtml
https://www.transfusion.eu.org/2014/06/18/gnu-screen-on-steroids/


Недавно узнал, что window-менеджеров не десять штук, а в разы больше =) Например, HiveOS использует легковесный аскетичный Openbox WM + Tint2:


https://laurvas.ru/openbox/

Git для самых маленьких и для совсем больших

https://ohmygit.org/

Git LFS vs Git Annex:

side-to-side comparison: https://workingconcept.com/blog/git-annex-vs-git-lfs (pdf)
вводный обзор, как работать с annex: https://blog.debiania.in.ua/posts/2013-12-15-advertising-git-annex.html (pdf)

Основное юзабилити-отличие:

With Git LFS, new developers cloning a Git LFS-enabled repo for the first time don’t need to know anything about it. They can use «git lfs clone» to have that initial clone come down faster, but they don’t have to. «git clone» alone is all they need.

Based on my reading just now (mainly Git Annex vs. Git LFS), with Git Annex new developers cloning the repo for the first time must also remember to invoke «git annex sync —content» after cloning. They must also remember to run that same command after adding new files.

While it probably does not seem like a lot to remember (one extra command to type), in my experience adding one extra command to a workflow can impair productivity pretty signficantly — especially if people sometimes forget to run that command.

— https://www.reddit.com/r/git/comments/7vgudg/why_or_is_git_lfs_winning/

Backing up Mikrotik RouterOS config to Git repository

#!/bin/sh
cd /home/user/mikrot-config/
/usr/bin/ssh -i /home/user/.ssh/id_rsa admin-ssh-account@ip.address.of.mikrot "export" > /home/user/mikrot-config/mikrot.conf 2>&1
#deletes first line with datetime for committing only config changes
/bin/sed -i '1{/by RouterOS 6/d;}' /home/user/mikrot-config/mikrot.conf
git add ./mikrot.conf
git commit -m "backup as of $(/bin/date +\%Y-\%m-\%d-\%H-\%M-\%S)"

if you need to backup a lot of hosts and webface for backup control, check https://www.ekzorchik.ru/2019/03/backing-up-mikrotik-via-oxidized/ (pdf)

Git clone branch from one remote to another by webhook call

quick and (very) dirty:

1.

git clone repo.git
cd repo
git status
git remote -v
git remote set-url --push origin git@github.com:User/repo.git

this should set your remote.origin.pushurl to another path, check it with

git remote -v

2. check it with

git pull origin master && git push

3. make sure you set your private and public ssh keys for pulling and pushing seamlessly

4. write bash script for this, for example:

cd /home/lol/repo/
echo $(date +%Y-%m-%d-%H:%M) >> /home/lol/copy-repo.log
git pull origin master >> /home/lol/copy-repo.log 2>&1
git push >> /home/lol/copy-repo.log 2>&1

You can skip and do this directly from within Python flask server with https://gitpython.readthedocs.io/en/stable/tutorial.html

5. Set up webhook @ first webservice to call @ push event. Write flask-server for getting webhooks, open incoming port, for example:

from flask import Flask
from flask import request
from bitbucket_webhooks import event_schemas
from bitbucket_webhooks import hooks
from bitbucket_webhooks import router
import subprocess

app = Flask(__name__)

@app.route("/hooks", methods=["POST"])
def bb_webhooks_handler():
    router.route(request.headers["X-Event-Key"], request.json)
    return ("", 204)

@hooks.repo_push
def _handle_repo_push(event: event_schemas.RepoPush):
    print(f"One or more commits pushed to: {event.repository.name}")
    subprocess.call("/home/lol/copy-repo.sh")

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=617, debug=False)

or if you prefer bash+netcat-like way, consider trying this https://gist.github.com/orangeblock/15ee8e3cb304a4046082b422adaaf5fb

6. wrap it into waitress call (i don’t know why but flask says it sufficient 😀 ):

if __name__ == '__main__':
    from waitress import serve
    serve(app,host="0.0.0.0",port=617)

7. wrap it into Systemd unit (https://blog.miguelgrinberg.com/post/running-a-flask-application-as-a-service-with-systemd):

[Unit]
Description=Webhook monitor for copying repo from BB to GitHub
After=network.target

[Service]
User=lol
WorkingDirectory=/home/lol
ExecStart=/usr/bin/python3 /home/lol/clone-repo-webhook-server.py
Restart=always

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start clone-repo-webhook-server
systemctl enable clone-repo-webhook-server

p.s. and you could combine this with git full-mirroring capabilities as you like
p.s. heres bb man https://support.atlassian.com/bitbucket-cloud/docs/create-and-trigger-a-webhook-tutorial/ and webhook listener repo https://bitbucket.org/atlassianlabs/webhook-listener which I haven’t read

FreeCad quick intro

SVG to FreeCAD:

quickest intro ever:

И ещё немножко мануалов по сборке сложных деталей:
https://wiki.freecadweb.org/Sketcher_Workbench


Канал с примерами:
https://www.youtube.com/channel/UC5nqtWv3094XLubtxzvK8zg

Current stable version 18.4 содержит неприятнейшую особенность — https://wiki.freecadweb.org/Topological_naming_problem

В последней 19 версии — она не исправлена, (хоть и неоднократно обещали), посему можно пользоваться продвинутым няшным форком:
https://github.com/realthunder/FreeCAD_assembly3/releases

Вот такую красоту (Himoto hi823402) можно сделать с нуля за пару вечеров: