Skip to content

Instantly share code, notes, and snippets.

@czuger
czuger / gist:d9bfc9fdf8a12ad475381dca078c2b4e
Last active July 18, 2025 08:36
Turn off deep sleep for an external USB HDD on raspberry pi
sudo vim /boot/firmware/cmdline.txt
# At the end of the command add
usbcore.autosuspend=-1
# Test with
cat /sys/module/usbcore/parameters/autosuspend
# Should show: -1
# Edit the hdparm configuration file:
@czuger
czuger / gist:476ed57c0fc83d6b8fa08090aa93b60b
Created April 14, 2025 14:19
Turn off swap on debian (raspberry pi)
sudo dphys-swapfile swapoff # If you don't want to reboot imediately.
sudo systemctl disable dphys-swapfile.service
sudo apt purge dphys-swapfile # No need for it now.
@czuger
czuger / gist:2ee1b2900a0f2f09190f5bb4915282bb
Last active July 18, 2025 08:38
Modify docker data directory
# Edit or create a file in /etc/docker/daemon.json
sudo vim /etc/docker/daemon.json
# Modify or add
{
"data-root": "/new/data/root/path"
}
# Restart docker
@czuger
czuger / gist:ec4235128aa2f7e75964fd92eaecec86
Created December 25, 2024 11:32
Reset all commit author in branch history
git rebase -r --root --exec "git commit --amend --no-edit --author '[email protected]'"
@czuger
czuger / gist:97c8aaa2a7380eda82f8217760031aea
Created November 24, 2024 12:31
How to show virtualenv in zsh prompt
# First ensure you enabled auto-activation of virtualenvs
# https://github.com/pyenv/pyenv-virtualenv
# echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
# Then follow
# https://barker.codes/blog/adding-the-virtual-environment-name-to-your-prompt-with-oh-my-zsh/
# May also face this :
# https://stackoverflow.com/questions/38928717/virtualenv-name-not-show-in-zsh-prompt
@czuger
czuger / gist:58eb85940b33fb70fd0379cad559d4ad
Created November 24, 2024 12:07
Key binding on mac os , replacing , -> . on numpad
mkdir -p ~/Library/KeyBindings/
touch ~/Library/KeyBindings/DefaultKeyBinding.dict
vim DefaultKeyBinding.dict
# Insert
{
"#," = ("insertText:", ".");
}
# https://ss64.com/mac/syntax-keybindings.html
@czuger
czuger / gist:8900bed2fc9ec2b616d7b0597f1215a6
Last active November 24, 2024 12:31
Pyenv install for M4
brew install liblzma-dev
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
eval "$(pyenv init -)"
@czuger
czuger / psql.sh
Created June 17, 2024 16:39
Intstall psql client on Mac Os
brew doctor
brew update
brew install libpq
brew link --force libpq
@czuger
czuger / python_install.sh
Last active June 17, 2024 16:29
Python + pyenv for mac
brew install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev
brew install libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev pkg-config liblzma-dev git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
@czuger
czuger / gist:ab5c932fd6569e339a5160a59727befa
Created June 5, 2024 08:08
Disable wifi and bluetooth on Raspberry Pi
# In /boot/firmware/config.txt (or /boot/config.txt)
# After [all], add
dtoverlay=disable-wifi
dtoverlay=disable-bt