having fun

OpenSource game engines (re3 is blocked again)

новость на opennet про re3: https://www.opennet.ru/opennews/art.shtml?num=54635

re3 заблокировали 29 сентября снова: https://github.com/GTAmodding/re3
Зеркало https://gitee.com/aeiouaeiouaeiouaeiouaeiouaeiou/re3
Тем, кому нужны бинарники, могу предложить поискать их по именам:
10381645 байт MD5 F6AF099E50EABD7568B658436FC22104
9240703 байт MD5 9C303AB17500C38257AC876262BF952F
10154366 байт MD5 B363FDA9E51941C3717213BC85B36110
8995659 байт MD5 97B8552D773ADC4DC858F3090559F0CD
где-нить в https://duckduckgo.com, или здесь, например: loess.ru/temp/re3

OpenAge — открытый движок для игр Age of Empires, Age of Empires II (HD) и Star Wars: Galactic Battlegrounds;
OpenSAGE — открытый движок для Command & Conquer: Generals;
OpenMW — открытый движок для ролевой игры в жанре фэнтези The Elder Scrolls 3: Morrowind;
OpenRA — открытый движок для Command & Conquer Tiberian Dawn, C&C Red Alert и Dune 2000;
OpenLoco — открытый симулятор транспортной компании на основе игры Locomotion;
CorsixTH — открытый движок для Theme Hospital;
OpenRCT2 — открытый движок для стратегической игры RollerCoaster Tycoon 2;
Xash3D — открытый движок с поддержкой Half-Life;
FreeCS — открытый движок для Counter-Strike 1.5.
https://github.com/vcmi/vcmi — OpenSource engine for HoMM3

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


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

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:


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)

def _handle_repo_push(event: event_schemas.RepoPush):
    print(f"One or more commits pushed to: {event.repository.name}")

if __name__ == '__main__':
    app.run(host="", 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

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

Description=Webhook monitor for copying repo from BB to GitHub

ExecStart=/usr/bin/python3 /home/lol/clone-repo-webhook-server.py

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

Git tools: diff docx/pdf, git server

Using git diff for doc, xls, pdf, ppt, odt:

https://gist.github.com/mbrehin/634f46aeacb0a9a6da5e (pdf)
for docx use pandoc as following (https://blog.martinfenner.org/posts/using-microsoft-word-with-git):

[diff "docx"]
textconv=pandoc --to=markdown
prompt = false

Git personal server

(Gitolite, Cgit, fcgiwrap, and Nginx)

https://bryanbrattlof.com/cgit-nginx-gitolite-a-personal-git-server/ (pdf)

and more of freshly-baked gitlab alternatives: https://www.cyberciti.biz/open-source/github-alternatives-open-source-seflt-hosted/

Backing up your git repos

git clone --mirror path/to/original path/to/dest/.git
cd path/to/dest
git config --bool core.bare false
git checkout anybranch


p.s. можно просто git clone --mirror path/to/original,
затем — mv original.git .git и далее — по инструкции git config..., git checkout...