Skip to content

Instantly share code, notes, and snippets.

@msoltysik
msoltysik / README.md
Created May 24, 2025 20:59
Memory Leak Simulation with `memray`

Memory Leak Simulation with Memray

This project demonstrates how memory leaks can occur in Python when using strong references and how to avoid them using weak references.

It simulates a scenario where many LeakyReader objects are created and then discarded, and compares two approaches:

  • ProblematicProvider (causes memory leaks)
  • FixedProvider (avoids memory leaks)

🧪 Requirements

Keybase proof

I hereby claim:

  • I am msoltysik on github.
  • I am msoltysik (https://keybase.io/msoltysik) on keybase.
  • I have a public key ASDcZsrpmqtsyZUvfSpMcIa4eKooCt8GwBf_7oN_V5eUxwo

To claim this, I am signing this object:

nmcli radio wifi off
To re-enable, use
nmcli radio wifi on

Keybase proof

I hereby claim:

  • I am msoltysik on github.
  • I am msoltysik (https://keybase.io/msoltysik) on keybase.
  • I have a public key ASByAvhh16eO8znvxAjCoFmeJiYezInBAtD8fUmpt-F_NAo

To claim this, I am signing this object:

Temporary:
echo '1' > /sys/module/hid_apple/parameters/swap_opt_cmd # swap cmd with alt.
Pernament:
$ echo options hid_apple swap_opt_cmd=1 | sudo tee -a /etc/modprobe.d/hid_apple.conf
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgADCT4AMhPhQpcbn+YUJi9ikw6ZqJWU6NLtIT3UtJ2YsKp3BheWxvYWTFAu57ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTAxY2M3NDBlYjcxNmVlZGZlN2U3NjNkNDg3MGQ5ZTViMWY1ODc2MTBhN2U0OGU1OThjNTJjMjJjOTYwOTJhYmEzNjBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwMDAzMDkzZTAwMzIxM2UxNDI5NzFiOWZlNjE0MjYyZjYyOTMwZTk5YTg5NTk0ZThkMmVkMjEzZGQ0YjQ5ZDk4YjBhIiwidWlkIjoiNzM0ZjIzMDA5NWI2MzRmNDc1ZjNkNzkyMjk0NzM4MTkiLCJ1c2VybmFtZSI6Im1zb2x0eXNpayJ9LCJzZXJ2aWNlIjp7Im5hbWUiOiJnaXRodWIiLCJ1c2VybmFtZSI6Im1zb2x0eXNpayJ9LCJ0eXBlIjoid2ViX3NlcnZpY2VfYmluZGluZyIsInZlcnNpb24iOjF9LCJjbGllbnQiOnsibmFtZSI6ImtleWJhc2UuaW8gZ28gY2xpZW50IiwidmVyc2lvbiI6IjEuMC4xNiJ9LCJjdGltZSI6MTQ2ODUyNjUxNiwiZXhwaXJlX2luIjo1MDQ1NzYwMDAsIm1lcmtsZV9yb290Ijp7ImN0aW1lIjoxNDY4NTI2NTA5LCJoYXNoIjoiMjBmY2E4ZDY2OTk1NWUxMmMxZjEyNmJiM2M2ODVjNDE5MzYyNWIyOGRjZTAxYjMzYjFjMzQzYWY4MmViZWRiMWJiNzBlMGZhZTFkNGI0MzZiOTEyZWI4NDExMGM3ODFkYjI2ZTU3NjA1ZTE2NzUzNzRmZTNmZTk1ZDNmNTlkOTEiLCJzZXFubyI6NTI0MTUzfSwicHJldiI6ImU5NGRmMTA4MDU2YzZhNjFiZGY4MjBlODA4YzhkNTk2
#!/bin/bash
# Remove all containers
docker rm -f $(docker ps -a -q)
# Remove all images
docker rmi -f $(docker images -q)
# Remove all stopped containers.
docker rm $(docker ps -a -q)
git config --global alias.l log
git config --global alias.co checkout
git config --global alias.br for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
@msoltysik
msoltysik / gist:99ab74935db20136415f
Last active August 29, 2015 14:26 — forked from speric/gist:6096965
vimtutor Lesson Summaries
Lesson 1 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
2. To start Vim from the shell prompt type: vim FILENAME <ENTER>
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes.
OR type: <ESC> :wq <ENTER> to save the changes.