Skip to content

Instantly share code, notes, and snippets.

View mvidaldp's full-sized avatar
🎯
Focusing

Marc Vidal De Palol mvidaldp

🎯
Focusing
  • Cologne, Germany
View GitHub Profile
@mvidaldp
mvidaldp / how_to_add_venv_on_jupyter_notebook_lab.md
Last active March 27, 2020 12:40
Add venv (virtual environment) Python kernel to Jupyter Lab or Jupyter Notebook

Assuming you are on your virtual environment:

pip install ipykernel
python -m ipykernel install --user --name venvname --display-name "Python (venvname)"
# run `jupyter kernelspec uninstall venvname` to remove it afterwards
@mvidaldp
mvidaldp / ignore_large_files_on_github.sh
Created March 9, 2020 13:53
Automatically find and ignore large files on GitHub
#!/bin/bash
# change data/ for your folder name or . for current
# change +50M for the file size you want to ignore
find data/ -size +50M | cat >> .gitignore
@mvidaldp
mvidaldp / launcher.desktop
Created March 18, 2020 12:33
How to make Linux launchers (.desktop) use environment variables (normally on .bashrc)
[Desktop Entry]
# Note that this is not a complete launcher entry
# make sure you modify the Exec parameter of your launcher like this example
Exec=sh -c "YOURVAR=yourpathorvalue /usr/bin/yourApp"
@mvidaldp
mvidaldp / HowTo_RevealJS_to_PDF.md
Last active April 16, 2020 15:16
How to convert Reveal.js slides to PDF
  1. Rename your Reveal.js slides URL ending by adding ?print-pdf. Example:
https://127.0.0.1/presentation.slides.html?print-pdf
  1. By reloading the slides with this URL ending, all slides are shown after each other and are ready to be printed.
  2. Then, in your web browser menu, go to Print..., then select Print to File and finally click the Print button.
@mvidaldp
mvidaldp / HowTo_ipynb_to_RevealJS_slides.md
Created April 16, 2020 15:35
How to convert Jupyter Notebook into Reveal.js slides excluding code
  1. Assuming your slides are already defined on your notebook, add the tag to_remove to all cells you don't want the code to be shown on your presentation.
  2. Then run this on your terminal:
jupyter nbconvert presentation.ipynb --to slides --no-prompt --TagRemovePreprocessor.remove_input_tags={\"to_remove\"} --post serve --SlidesExporter.reveal_theme=simple
@mvidaldp
mvidaldp / HowTo_Pull_APK_from_installed_app_from_Android.md
Created May 13, 2020 16:53
Get APK from installed app from Android device

Assuming you have adb installed in your OS, your Android phone is connected to it via USB, debugging is enabled, and you can see your phone running adb devices. Open your terminal and run:

adb shell pm list packages |grep AppName

This will show you something like package:/path/to/your/app.apk Without |grep AppName or the search filter you use it will list all installed Apps.

Finally, just run:

@mvidaldp
mvidaldp / switch_case.py
Created May 25, 2020 10:14
How to emulate switch/case in Python
def switch_case(value):
return {
0: 'case for 0',
1: 'case for 1',
2: 'case for 2',
# ...
}[value]
result = switch_case(value_to_evaluate)
@mvidaldp
mvidaldp / lsl_api.cfg
Last active December 3, 2020 22:33
How to enforce LSL LabRecorder to default timestamps: create the file -> ~/lsl_api/lsl_api.cfg (C:/Users/username/lsl_api.cfg on Windows)
[tuning]
ForceDefaultTimestamps = 1
@mvidaldp
mvidaldp / .bashrc
Last active June 11, 2020 20:19
Set user PS1 to [Day Month DayNumber HH:MM] user@host ~ $ on ~/.bashrc
# assuming you have ncurses installed on your system
PS1="\[$(tput setaf 6)\][\d \A]\[$(tput bold)\]\[$(tput setaf 2)\] \u\[$(tput setaf 0)\]@\[$(tput setaf 3)\]\h \[$(tput setaf 4)\]\w\[$(tput bold)\]\[$(tput setaf 2)\] \\$\[$(tput sgr0)\] "
@mvidaldp
mvidaldp / .bashrc
Last active June 11, 2020 20:20
Set root PS1 to [Day Month DayNumber HH:MM] root@host /path/ $ on /root/.bashrc
# assuming you have ncurses installed on your system
PS1="\[$(tput setaf 6)\][\d \A]\[$(tput bold)\]\[$(tput setaf 1)\] \u\[$(tput setaf 2)\]@\[$(tput setaf 3)\]\h \[$(tput bold)\]\[$(tput setaf 4)\]\w\[$(tput bold)\]\[$(tput setaf 1)\] \\$\[$(tput sgr0)\] "