Skip to content

Instantly share code, notes, and snippets.

View ErykDarnowski's full-sized avatar
🔧
Tinkering

Eryk Darnowski ErykDarnowski

🔧
Tinkering
View GitHub Profile
@ErykDarnowski
ErykDarnowski / README.md
Last active December 9, 2022 01:15
A sane npkill command (shouldn't show anything related to Vim plugins, VScode extensions npm / npx caches and so on).
npx npkill -f -s size -E ".config, .cache, .local, .nvm, .npm, .vscode"
@ErykDarnowski
ErykDarnowski / check.sh
Last active April 30, 2023 10:50
How to check if Laravel's `sail up` command is finished (if all the containers are healthy) before doing other actions (like migrating a DB and so on) in bash. Concept by @rosiakpiotr execution by me :)
#!/bin/bash
check_sail_containers_status() {
# A bit of delay to not run the function too quickly:
sleep 2
# Getting current container state:
local STATUS=$(sudo ./vendor/bin/sail ps | grep starting)
# Checking if they're healthy:
@ErykDarnowski
ErykDarnowski / bat_report.bat
Last active April 30, 2023 10:53
How to automatically generate and open a battery report file on Windows
@echo off
:: Vars:
SET filename=battery-report.html
:: Generate the battery report file (in script's path):
powercfg /batteryreport > nul
:: Open the file (in the default browser):
@ErykDarnowski
ErykDarnowski / README.md
Last active April 30, 2023 11:01
How to fix Vim / Neovim not copying to system clipboard

How to fix Vim / Neovim not copying to system clipboard

If you can't copy text from Vim / Neovim to your system's clipboard, for instance when using the "+y shortcut (I've encountered this issue when testing out Fedora + KDE + Wayland).

Try installing the wl-clipboard package, like so:

sudo dnf install wl-clipboard
@ErykDarnowski
ErykDarnowski / mount.md
Last active April 30, 2023 11:12
How to (temporarily) mount drive installed in computer in a live Linux USB

How to (temporarily) mount drive installed in computer in a live Linux USB

Prepare by burning Linux on to a USB drive and booting in to it (on the computer that has the drive/s you want to access installed).


  1. Find the drive's path (something along the lines of /dev/nvme0n1p3): sudo fdisk -l
  2. Create a directory for mounting it: sudo mkdir -p /mnt/drive
  3. Mount it: sudo mount <drive_path> /mnt/drive
  4. Access it: cd /mnt/drive
@ErykDarnowski
ErykDarnowski / README.md
Last active April 30, 2023 11:15
How to fix the `-bash: /usr/bin/scp: No such file or directory` error when trying to use `scp`

How to fix the -bash: /usr/bin/scp: No such file or directory error when trying to use [scp][1]

Simply install [openssh][2], like so:

# on Arch:
sudo pacman -S openssh

and try using [scp][1] again!

@ErykDarnowski
ErykDarnowski / README.md
Last active April 30, 2023 11:16
How to run `diff` on outputs of two commands

How to run diff on outputs of two commands

diff <(<first_command>) <(<second_command>)
@ErykDarnowski
ErykDarnowski / README.md
Last active April 30, 2023 11:16
How to fix the `bash: unmount: command not found` error

How to fix the bash: unmount: command not found error

It's a sneaky one (a typo), you need to use: umount instead!

@ErykDarnowski
ErykDarnowski / pkgName.ts
Last active April 30, 2023 11:19
How to get app's package name in Expo app (in React Native). This is a quick and dirty hack for getting the app's package name when testing stuff out and switching between the managed and bare (ejected) workflow. In my case this was heplful when linking the user to the app's notification settings page,
import { expo as appJson } from '../app.json';
// @ts-ignore
const packageName: string = appJson.android.package ?? 'host.exp.exponent';
// ^ Gets the apps package name, however if the `Expo Go` app is used it defaults to it's package name.
@ErykDarnowski
ErykDarnowski / dnf.conf
Last active April 30, 2023 11:19
How to speed up `dnf` the default pkg manager used by Fedora Linux, simply append these lines to the `/etc/dnf/dnf.conf` config file. Remember to edit it with `sudo`!
max_parallel_downloads=10 # Increases amount of concurrent pkg downloads (you can also try tweaking this option)
fastestmirror=True # Picks the fastest mirror
defaultyes=True # Makes the defualt option in `[y/N]` menus 'Y' instead of 'N' (so you don't have to type 'y' every time)