Skip to content

Instantly share code, notes, and snippets.

@aleksejalex
Last active September 10, 2024 15:16
Show Gist options
  • Save aleksejalex/71ec588f016dbce1a433005c1226f480 to your computer and use it in GitHub Desktop.
Save aleksejalex/71ec588f016dbce1a433005c1226f480 to your computer and use it in GitHub Desktop.

pyenv management

pyenv local 3.10 --- set in curr dir
pyenv versions ---- list all available
pyenv install 3.9 

note: you even can use python installed via PYENV for compiling inside Pycharm. Very convenient.

.venv - how to work with it without GUI helpers

(!!!) first set up your python version if using pyenv (!!!)

python3 -m venv .venv
source .venv/bin/activate
deactivate

keys - reassign macros

acpi_listen # enter and press key you want to get code of

https://wiki.gentoo.org/wiki/ACPI/ThinkPad-special-buttons - great tutorial

pip update all installed packages

pip install --upgrade $(pip freeze | awk '{split($0, a, "=="); print a[1]}')

git forget local changes and download from remote:

git reset --hard   # forgets local changes
git fetch origin
git pull origin <branch_name>

video streams:

/dev/video0  ...common camera
/dev/video2  ...IR camera
    # this command will make that IR diode will self activate when the video stream is requested in for instance VLC or google meet:
    chicony-ir-toggle -d /dev/video2 on
    # this cmd was compiled from source by me on 20240106 from there>> https://github.com/PetePriority/chicony-ir-toggle

# device manager - alternative
sudo lshw
lspci   # pci devices
lsusb   # usb devices

connect to SSH (ex. institute's computing)>>

ssh myname@server.institute.cz

get detailed description of installed SSD disk >>

sudo nvme list
sudo nvme smart-log /dev/nvmeXXX

if Xfce is running on Mint, but it doesn't look like Mint's Xfce >>>

xfce4-panel --quit ; pkill xfconfd ; rm -rf ~/.config/xfce4/panel ; rm -rf ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ; xfce4-panel

details here >>

https://forums.linuxmint.com/viewtopic.php?t=344023

Clam antivirus in terminal

clamscan MyFile.txt
clamscan suspiciousdir

Remote server (via terminal) >>

run on remote even after signing out:

[myname@server]$ nohup taskset -c 1,2 python measure_script.py &
--- this is how to run in background (nohup &) a task (py...) on remote server on logical cores 1 and 2

scp platform_info.py   myname@server.institute.cz:~/working_dir
--- this is how to send a file to the remote server (directly inside specified directory)

scp -r myname@server.institute.cz:~/remote_dir/ ./my_local_dir 
--- move directory remote_dir to my_local_dir (NO -r IF COPYING SINGLE FILE)

run jupyterlab on server and see GUI in local machine:

  1. connect local machine through VPN to UTIA
  2. connect via ssh myname@server.institute.cz
  3. activate the conda env: conda activate my_custom_env
  4. start jupyterlab on server and specify the port: jupyter lab --no-browser --port=8888 --ip=0.0.0.0
  5. in another terminal locally, go for this: ssh -L 8888:localhost:8888 myname@server.institute.cz
  6. lastly, open link to the jupyterlab in your local browser (something like http://127.0.0.1:8888/lab )

pandoc : universal convertor between LaTeX, Word, MarkDown, RTF, HTML, TXT, EPUB, ...

link: https://pandoc.org/demos.html I tried:

pandoc -s DP_AG.tex -o example2.docx
pandoc -s Layout_AG.docx -o example3.tex

LaTeX to Word works surprisingly well...

VM on Linux - the most lightweight option:

sudo apt install qemu-system 
sudo apt install virt-manager (just GUI interface to manage 'qemu-system')

SSD - force TRIM command on SSD:

sudo fstrim -v /

(-v means verbose, ie. it will speak)

Hard drive: tell me info and show the wear:

sudo smartctl -a /dev/nvme0n1

Check power profile(s) set on the machine >>

powerprofilesctl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment