← Înapoi la Urmăritori

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 50
  1. Patch private methods in python

    I’ve encountered this rather profane yet tricky problem while testing a method: class MyClass: def __method(self) -> str: pass def test() with patch.object(MyClass,"__method") as _: pass pytest E AttributeError: <class 'My…

  2. Display the wireless status on the emacs mode-line

    I found this code1 to display the wireless status in the modeline.

  3. Stop google chromium from hijacking MIMEs on arch linux

    In addition to this blogpost – whom focuses on chrome but on chromium, I had to run the following command to get rid of the chromium tick: sudo sed -i 's/chromium.desktop;//' /usr/share/applications/mimeinfo.cache

  4. Writing in ancient greek with Emacs and Linux

    For starters, you want to write brother in ancient greek.

  5. Understanding yield in python

    I’m testing a script against a live database.

  6. Beware of emacs pytest runner defaults

    Emacs provides an incredible python developer experience.

  7. A minimal example of using namedtuples in pytest parameterized tests

    What means - in the test parameters below?

  8. Patch the async json response of a mocked aiohttp clientsession in pytest

    Haven’t found a short concise example covering pytest whilst focussing the patched json method of a mocked async session, hence this snippet.

  9. Django python IDE autocompletion in emacs

    Presuming a working python layer, following settings will provide autocompletion. e.g. typing Mymodel.ob will suggest Mymodel.objects for completion. yay basedpyright ~/.spacemacs.d/init.el (defun dotspacemacs/user-config () (use-package lsp-pyright :en…

  10. Play a video from emacs org mode using lisp

    Links in Emacs org mode allow arbitrary emacs-lisp execution.

  11. Ignore regions when formatting buffers with three keys

    I’m quite fond of keeping my code formatted.

  12. Get an email upon failed systemd services

    Only by chance, I noticed a failed systemd service.

  13. Labeling code blocks in ox-hugo

    Table of Contents Problems Solution What happens How it works By chance, I stumbled over an excellent article1 about labeling code blocks in hugo.

  14. Mark tagged files partially in image-dired

    Given your image-dired tags have similar beginnings e.g 0.jpg;foo 1.jpg;foo: Now all you enter – in order to mark – images tagged with foo but not foo:, is this: M-x image-dired-mark-tagged-files foo$ Note the dollar sign suffix Why is such profane regex…

  15. Create a public S3 bucket using the aws cli

    Table of Contents Create an arbitrary bucket name Create the bucket Delete public access block Create a policy to allow public read access on the bucket Apply the policy to the bucket Create an example file Upload the example file to our bucket [Assert] D…

  16. Call a bash script with arguments in python

    /tmp/foo.py arguments=" ".join(["foo", "bar"]) cmd="foo.sh" subprocess.run(['/bin/env', cmd]+arguments) /tmp/foo.sh #!

  17. Fix treemacs-add-project wrong type argument hash table p nil

    After a recent cleanup of treemacs projects, I wanted to add again a known project: ~/src/django Yet M-x treemacs-add-project returned (wrong-type-argument hash-table-p nil) Debugging with M-x debug-on-error gave away a suspicious gethash call: Debugger e…

  18. Set up to share ox-hugo blog posts on social media

    While preparing to share this post on LinkedIn, I noticed something’s missing.

  19. Font awesome icons in hugo footer

    Table of Contents Directory path and completeness config.toml Usage of the icons with ox-hugo shortcodes in content Conclusion 👋 I followed this concise blog post1 about embedding font awesome in hugo.

  20. Python project packaging with pipenv pytest and cli

    Table of Contents A minimal python project Installing the package in a virtual environment using pipenv with python 3.8 Review the installation in perspective of pipenv and python 3.8 Run something from the cli Review our current (cli) project’s state How…

  21. How to pipenv install a git pull request from github

    Given is this pullrequest https://github.com/joeyespo/pytest-watch/pull/108 pipenv install -d \ git+https://github.com/joeyespo/pytest-watch.git@refs/pull/108/head#egg=pytest-watch The -d flag installs the package in the Pipfile’s [dev-packages] section T…

  22. Automating Image Manipulation in Emacs Dired Mode

    I manage my images using emacs dired, specifically image-dired.

  23. Blender python development workflow

    Edit the python script Keep a terminal open running the watch script e.g. $ sh watch.sh See the rendered result Each time you save the python script, the watch script gets notified and re-executes.

  24. Ignore transactions in ledger-cli

    Given is a ledger file containing imported bank transactions we want to ignore.

  25. Shark in a flower at sunrise in Venice

  26. Get latest ledger transaction's date only

    #Content of ~/tmp/file.dat 2099/02/07 * acme Expenses:Groceries $ 1 Assets:Cash 2089/11/07 * foobar Expenses:Groceries $ 4 Assets:Cash I want – from the account Assets:Cash a…

  27. Parse contacts from email in python

    Process all your email contacts using mu and python. mu-cfind returns all contacts: mu cfind Excerpt from the returned results ...

  28. Update your financial ledger by email in python

    Table of Contents Abstract Goal Manual process briefly explained Script - Step by step Complete script Abstract Each time I buy something and pay it later, my expenses and liabilities increase.

  29. Parse ledger-cli using python

    #Content of file.dat 2099/02/07 * foo ; MD5Sum: 4d2965fa2879f3c528006f2e9c3bca8d Expenses:Groceries CHF 10 Assets:Cash 2099/11/07 * bar ; MD5Sum: 4d2965fa2879f3c528006f2e9c3bca8e Expenses:Groceries

  30. Extract and convert vcf contacts from emails in python

    I wasn’t able to export my contacts from my iphone (iOS 11).

  31. Python unit testing in emacs org mode

    Using emacs org and babel1, I want to quickly note ideas in python.

  32. Create diagrams in emacs org mode

    Table of Contents Mermaid-cli Mermaid for org mode Usage Problem solving Being able to explain something with your words only prevails.

  33. Create a blender scene in python

    Using blender, I need to test multiple settings for my painting references e.g. lighting, material or the complete location.

  34. Test automation using GNU Make in ox-hugo

    Amongst others, I run this script as part of my tests after a system update.

  35. Annotate pictures non-invasively in latex/pdf using org mode

    Goal of this method is the non-invasive annotation of pictures in LaTeX/pdf.

  36. Code expansion in org mode prose text

    Say I want to write about the count of my system’s processors at the time of my writing.

  37. Fix [Pyright] Import could not be resolved in emacs

    Say you open any python file containing an import.

  38. Why do I need unit tests?

    So I want to compare if two dates are equal.

  39. How to use the ox-hugo Makefile

    Amongst others, I run this script as part of my tests after a system update. cd /tmp #Cleanup rm -r ox-hugo #Clone latest repository git clone git@github.com:kaushalmodi/ox-hugo.git cd ox-hugo #Make change in org file sed -i "s/\(Kaushal\)/The awesome \1/"

  40. Scraping Migros M-Budget with python

    Table of Contents Motivation How to understand this post Script ingredients Modules Urls Process overview Visit the ISP’s login page Login Get the consumption values Logout Complete script Usage Conclusion Motivation I recently caught myself repeatedly ch…

  41. Testing APIs offline and fast with vcrpy

    Table of Contents Motivation Requirements Create the test Run the test Check folders and files Go offline Run the test again - offline Go back online Conclusion Motivation While testing code against online sources like websites or APIs I often find myself…

  42. Take website screenshots with headless Firefox

    This script takes a screenshot of a website.

  43. Mount a USB drive persistently for all users

    Table of Contents Create a mount point List devices Backup & print current fstab Add the device to fstab Change device’s permission Test Cleanup Troubleshooting I need to persistently permit all users read/write access to a USB drive Create a mount point…

  44. Backup an iPhone with Linux

    Table of Contents Install the necessary packages Find the event iPhone connected Catch the event iPhone connected Create the trigger iPhone connected Create the action Backup iPhone Restart and reload all actors (not the iPhone though) Monitor the backup…

  45. Change Firefox's zoom by script

    Each time I change the monitor I have to zoom in or out firefox.

  46. Connect an iPhone to a Raspi

    Table of Contents Unlock your iPhone Connect and login into your raspi Update - Retrieve new lists of packages Upgrade - Perform an upgrade Install the necessary packages Connect the iPhone with the raspi via USB Accept the trust dialog on the iPhone Pair…

  47. Setup a Fujitsu ix500 scanner on Linux

    Table of Contents Install package Approve the connection Get a list of devices: Get a list of all device specific options: Scan a test file Scan productively Skipping empty pages Alias the command Install package sudo apt install sane-utils -y Approve the…

  48. Take screenshots in emacs org mode with flameshot

    Figure 1: Screencast showing flameshot in action Setup Enable the org layer in your .spacemacs dotspacemacs-configuration-layers dotspacemacs-configuration-layers '(org) Install flameshot sudo pacman -S flameshot Add the line below to your .space…

  49. Write a letter in org mode

    Table of Contents Goals Setup Workflow (Spacemacs) Goals Figure 1: Printed sample.pdf In order to get the same printout as in figure 1 above, both includepdf lines starting at line 37 here must be uncommented.

  50. Blog in org mode with ox-hugo and github pages

    Table of Contents Setup ox-hugo Create a new github repo via web front-end Clone the new repository Setup Hugo in our new repository Create the new hugo site Download a theme and add it as git sub-module Create the org content folder Create a minimal org…