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 / service.timer
Created January 16, 2021 22:24
Example systemd timer to start a unit service after a specific time
[Unit]
Description=Start service.service 3 minutes after default.target
[Timer]
Unit=service.service
# set to desired time
OnBootSec=180s
[Install]
WantedBy=default.target
@mvidaldp
mvidaldp / reboot.service
Last active January 16, 2021 23:11
Example systemd unit service to schedule a reboot/shutdown at a specific time
[Unit]
Description=Shutdown at specific time
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
# remove the scheduled shutdown if any
ExecStartPre=/sbin/shutdown -c
# change to desired time, -r (restart), -P (poweroff/shutdown)
@mvidaldp
mvidaldp / touchscreentoggle.bat
Created January 10, 2021 19:03
Disable/enable (toggle) touch screen on Windows using Batch
:: Make sure you run the script with admin rights or it won't work
devcon find *hid\vid* | findstr "touch screen" > device_id.txt
set /p device=<device_id.txt
set "touchscreenid=%device:~0,33%"
devcon status "%touchscreenid%" | findstr "running"
if %errorlevel% == 0 (
devcon disable "%touchscreenid%"
) else (
devcon enable "%touchscreenid%"
)
@mvidaldp
mvidaldp / echo_string_with_ampersands.bat
Created January 10, 2021 18:52
Batch (.bat) script or command to read variable containing ampersands (&)
set "var=ABC&DEF&GHI&012"
echo %var:&=^&%
@mvidaldp
mvidaldp / git-lfs-track-files.sh
Created January 10, 2021 17:03
Tell git lfs to track multiple files (bigger than 50MB) from a list of files
#!/bin/bash
# assuming you are on your git repo folder and you generated a large file list (bigger than 50MB in this case), e.g.:
# find . -size +50M | cat >> file-list.txt
flist="file-list.txt"
while IFS= read -r file
do
git lfs track "$file"
done < "$flist"
@mvidaldp
mvidaldp / footer.php
Last active December 9, 2020 00:54
Custom WordPress footer for the Mesmerize theme
@mvidaldp
mvidaldp / remove_RSA_key_pass.sh
Last active December 4, 2020 01:54
Remove the pass phrase (password) of an RSA key
# assuming you know the key you want to remove
openssl rsa -in key_with_pass.pem -out key_without_pass.pem
# source: https://stackoverflow.com/a/18394172 - https://www.madboa.com/geek/openssl/#key-removepass
@mvidaldp
mvidaldp / howto_matlab_on_jupyter.md
Created November 23, 2020 13:00
How to use Matlab on Jupyter Notebooks
  1. Assuming you created a virtual environment called matlab, otherwise:
python -m venv matlab
  1. Activate the venv:
source matlab/bin/activate
  1. Assuming you have Matlab installed in your OS:
@mvidaldp
mvidaldp / custom_pbar_tqdm.gif
Last active November 19, 2020 19:47
How to make a customized progress bar in Python using TQDM (https://github.com/tqdm/tqdm)
custom_pbar_tqdm.gif
@mvidaldp
mvidaldp / Detach.txt
Last active November 19, 2020 18:26
How to detach Android apps from PlayStore to prevent autoupdate.
- Given that your phone is rooted with Magisk (https://github.com/topjohnwu/Magisk), place this "Detach.txt" file on "/storage/emulated/0/" and include your app names after line 45 (run `adb shell 'pm list packages -f'` to get their names). Finally, just install Detach module using Magisk (https://github.com/Magisk-Modules-Repo/Detach) and reboot.
- Detach Market Apps Configuration -
- Remove comment (#) to detach an App.
#Contacts
#Gmail
#Google App
#Google Plus
#Hangouts
#Phone