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 / config.conf
Last active December 5, 2023 12:08
Custom neofetch config with icons and more colors (see image). Location -> $HOME/.config/neofetch/config.conf
# See this wiki page for more info:
# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info
print_info() {
info "$(color 10)" title
prin "$(color 12)───────────── $(color 1)Hardware$(color 12) ────────────"
info "$(color 1)" model
info "$(color 1)󰍛" cpu
info "$(color 1)󰍹" gpu
# info "$(color 1)CPU Usage" cpu_usage
info "$(color 1)" gpu_driver # Linux/macOS only
@mvidaldp
mvidaldp / store_python_packages_with_versions.sh
Created May 18, 2023 12:30
Store current Python packages versions using pip freeze
# Assuming you are in your desired Python environment, just run:
pip freeze --local | grep = > requirements.txt
# "grep =" ensures it will only list packages and versions
# Then, for restoring the packages, just run "pip install -r requirements.txt"
@mvidaldp
mvidaldp / repair_windows_efi_bootloader.md
Created October 4, 2022 12:11
Repair Windows' EFI bootloader (e.g. after Linux or another OS overwrittes it)
  1. Use a Windows installation media and boot it
  2. Go to: Repair your computer > Troubleshoot > Advanced options > Startup Repair
  3. If it fails (like most of cases), go to: Repair your computer > Troubleshoot > Advanced options > Command Prompt
  4. There first run: diskpart
  5. Then run: list vol
  6. Select the Windows hidden partition: select volume X (where X is the number of the partition)
  7. Assign it a letter: assign letter=Y (make sure you assign an unused one)
  8. Exit diskpart, run: exit
  9. Run: bootrec /rebuildbcd
  10. Given that your Windows partition has the letter C: assigned, run: bcdboot c:\windows /s c:
@mvidaldp
mvidaldp / sdcard_fix.md
Created April 11, 2022 12:43
SD card formating fix via ADB shell when Android GUI fails (internal, portable/external or mixed). Works on Retroid Pocket 2+

I wrote this short tutorial because extending my internal storage using my new micro SD card on my Retroid Pocket 2+ failed all the time. Only setting it up as portable/external worked. However, this instructions should work in any Android 5.0+ device.

So, in case you have problems setting up your SD card on your Android device via graphical interface (setting up storage as extended internal memory or portable), and you get a corrupted SD card or any other error, follow these steps to fix it via adb shell:

  1. Make sure you have adb access to your Android device: Settings > System > About, touch/click on Build number until Developer options are enabled:
  2. Go to Settings > System > Developer options and enable USB debugging.
  3. Assuming you have adb installed on your remote terminal run the following:

adb shell

@mvidaldp
mvidaldp / external_storage_fix_android_11.sh
Created March 4, 2022 17:12
How to grant external storage permission on Android 11+ when the app is not adapted to the new scoped storage
# if you do not know your app id you can find it using: adb shell pm list packages -f`
adb shell appops set --uid your.app.id MANAGE_EXTERNAL_STORAGE allow
@mvidaldp
mvidaldp / dns_allowlist.txt
Created December 16, 2021 18:59
DNS allowlist
! This is a comment
||api.coingecko.com^
@mvidaldp
mvidaldp / .bashrc
Created December 12, 2021 14:03
Gentoo's modification of /etc/bashrc for a colored Bash
# Gentoo's modification of /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
@mvidaldp
mvidaldp / clean_unneeded_dependencies.sh
Created November 9, 2021 18:49
Remove unneeded package dependencies on Arch Linux based distros
sudo pacman -Rs $(sudo pacman -Qdtq)
@mvidaldp
mvidaldp / vpn-import.sh
Created September 7, 2021 11:39
How to import, rename and delete an openvpn connection using a config file from terminal.
# import the new connection using the vpn config file you have
sudo nmcli connection import type openvpn file config-file.ovpn
# rename an old/current connection:
sudo nmcli connection modify connectionId connection.id differentConnectionId
# rename the new imported connection
sudo nmcli connection modify config-file connection.id newConnectionId
sudo nmcli connection modify newConnectionId connection.interface-name newConnectionName
@mvidaldp
mvidaldp / silence_ssh-agent_commands.sh
Created March 8, 2021 14:40
Hide/silence ssh-agent or any other command/s on a Linux shell
{ eval "${ssh-agent}"; ssh-add .ssh/mykey; } &>/dev/null
# so -> { eval "${command1}"; command2; } &>/dev/null
# very useful for hiding .bashrc and .zshrc output
# source: https://unix.stackexchange.com/a/73607