Skip to content

September of 2021

Computer Science

GNULinux

cURL

  • New: Fetch a website that requires auth.

    curl -u username:password [url]
    

Docker

  • Reorganization: Re-organized sections.
  • New: Build an image from a git repository.

    docker build -t tag https://github.com/docker/rootfs.git#[tag_or_branch]
    
  • New: Remove unused data.

    Use docker system prune.

    And for automated clean up:

    Add the following line to crontab -e:

    0 3 * * * /usr/bin/docker system prune -f 2>&1 > /dev/null
    

    -f prevents manual confirmation from being asked.

Git

  • New: Pre-commit.

    pre-commit/pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.

    You can skip specific hooks with:

    SKIP=no-commit-to-branch pre-commit run --all-files
    

    Which is useful if a CI runs for the main branch so that it doesn't complain about running in it.

ImageMagick

  • New: Resize and compress a JPG image.

    Resize an image to width 1000 px and compress it with a JPG quality level of 80% in place:

    mogrify -quality 1000 -resize 80 file.jpg
    

MariaDB

  • New: Gain root access without the pass.

    mysqld_safe --skip-grant-tables --skip-networking &
    mysql -u root
    

netcat

  • New: Test TCP connections.

    nc -v -z -w 3 [host] [port]
    

    Options: * -v: verbose * -z: just check if the port is open and exit (without sending any data) * -w 3: 3 seconds timeout

    If it exists with return code 0, it means that the connection succeeded.

NGINX

  • New: Reverse proxy.

    location /something/ {
        proxy_pass http://127.0.0.1:8000/;  # note the trailing slash here, it matters!
    }
    

OpenLDAP

  • New: Don't check TLS cert.

    Add TLS_REQCERT never to /etc/openldap/ldap.conf.

OpenSSL

  • New: Get information about a certificate.

    openssl s_client -connect [host]:[port] | openssl x509 -noout -dates
    

uptimed

  • New: Uptimed.

    uptimed is an uptime record daemon keeping track of the highest uptimes a computer system ever had. It uses the system boot time to keep sessions apart from each other. uptimed comes with a console front-end to parse the records, which can also easily be used to show your records on a web page.

    To set up the program just install it with your package manager and it will start running in the background by default and keeping track of your uptime.

    To check the stats run uprecords.

neovim

  • Reorganization: Renamed vim to neovim.
  • New: Jedi-vim awesome Python autocomplete.

wget

  • New: Redirect output to stdout.

    wget -qO- [url]
    

Programming

asyncio

  • New: Python asyncio.

    asyncio is a library to write concurrent code using the async/await syntax.

asyncpg

  • New: Asyncpg.

    MagicStack/asyncpg is a fast PostgreSQL Database Client Library for Python/asyncio.

Basics

  • New: Rename a dictionary key.

    mydict[k_new] = mydict.pop(k_old)
    
  • New: str.count(sub[, start[, end]]).

    Return the number of non-overlapping occurrences of substring sub in the range [start, end].

TDD

  • New: Test-driven development (TDD).

    Test-driven development (TDD) is a software development process consisting in small development cycles. The goal is clean code that works. Some advantages of this methodology are that it reduces stress in the development process and produces functional code that is a pleasure to work with.

  • New: Exploratory coding (spiking).

    When learning a new tool or exploring a new possible solution, it’s often appropriate to leave the rigorous TDD process to one side, and build a little prototype without tests, or perhaps with very few tests. The goat doesn't mind looking the other way for a bit.

    For de-spiking, rewrite your prototype code using TDD.

Decorators

  • New: Overrides decorator.

    overrides is a decorator that verifies that a method that should override an inherited method actually does, and that copies the docstring of the inherited method to the overridden method.

Linters

  • New: Pydocstyle missing docstrings overr.

    To allow missing docstrings when overriding methods you can use the @overrides decorator and the command line option --ignore-decorator=overrides or the setting ignore_decorator = "overrides" in the configuration file.

pip

  • New: Pip-tools.

    jazzband/pip-tools are a set of tools to keep your pinned Python dependencies fresh.

    Usage of pip-compile and of pip-sync.

pytest

  • New: Capture stdout/stderr output.

    Use the capfd fixture.

    Example:

    def test_foo(capfd):
        foo()  # Writes "Hello World!" to stdout
        out, err = capfd.readouterr()
        assert out == "Hello World!"
    

re

  • New: Split a string by multiple delimiters.

    import re
    re.split('; |, ', "string")
    

unittest

  • New: Patch an abstract class.

    To patch an abstract class to be able to instantiate it, without having to create a fake class that inherits from it, you can patch it as follows:

    @patch.object(MyAbcClass, '__abstractmethods__', set())
    

    or if you want to patch some attributes and/or methods at the same time:

    @patch.multiple(MyAbcClass, __abstractmethods__=set())
    

Countries

Turkey

Touristic visa

  • New: Mogan lake.
  • New: Personal experience.

Eskişehir

  • New: Eskişehir travel guide.

Other

  • New: How to get rid of the spinning wheel.

    Run exec and exec_always with --no-startup-id if the command won't generate a window, otherwise the spinning wheel will get stuck and appear instead of the normal mouse icon.

  • Reorganization: Moved articles to legal.

  • New: Add Nina Zakharenko PyCon pdb talk.