Skip to content

Instantly share code, notes, and snippets.

View JohnRTitor's full-sized avatar
🙂
Not much, hbu?

Masum Reza JohnRTitor

🙂
Not much, hbu?
View GitHub Profile
@JohnRTitor
JohnRTitor / mariadb-nginx-phpfpm.md
Last active October 3, 2024 05:35
MariaDB setup + Nginx + PHP FPM for PHP connections

YOu can use mycli helper to get a syntax hightlighted and multiline SQL interpreter.

mycli -u masum-db -h localhost -D bookmyshow

where bookmyshow is the database name, localhost is the hostname, masum-db is the user accessing from the hostname.


Or use the traditional mariadb or mysql.

@JohnRTitor
JohnRTitor / refind-nixos.md
Last active August 30, 2024 09:28
reFINd install on NixOS Secureboot

Refind is a beautiful and customisable boot manager. It can be installed easily on NixOS by a simple command.

Regular users

Run the following commands to get a shell with required components.

nix-shell -p refind efibootmgr sbsigntool

Now you can run refind-install to install the boot manager on to your EFI.

@JohnRTitor
JohnRTitor / 7zip-instruction.txt
Last active November 4, 2024 16:13
7zip encrypted
Needs _7zz from nixpkgs
7zz a -tzip -pTHISISTHEPASSWORD -mem=AES256 archive.zip hello.txt
7zz x archive.zip -pTHISISTHEPASSWORD
@JohnRTitor
JohnRTitor / nix-tricks.md
Last active November 10, 2024 07:34
Nix Tips and Tricks

Build normal packages - x64

# x64 packages or architechture
nix build ".#hello"

# 32bit x86 packages
nix build ".#pkgsi686Linux.hello"

# 32bit x86 drivers
@JohnRTitor
JohnRTitor / linux-tips.md
Last active April 3, 2024 18:18
Linux Tips and Tricks

Home directory and env vars not set properly in su (switch user)

Use a login shell mode instead, it will initiate the client user's profile and rc scripts. It also prevents the client user shell from inheriting host env vars.

su -l example-user

Capture text from stderr

cat command using pipe | can only capture data from stdout.

Use this to capture data from stderr as well. Here less is used as pipe destination.

@JohnRTitor
JohnRTitor / linux-boot-missing.md
Last active March 30, 2024 07:01
Linux Boot entry missing after BIOS update

Sometimes after BIOS updates, Linux boot entry can be missing from Boot menu. This happens with BIOS updates auto clearing secure boot keys and EFI variables.

If using Ubuntu where Grub is used

it can be solved by mounting the EFI partition from a Windows system.

  • Mount the efi parition using diskpart using elevated Command Prompt
    • list disk "Look for the disk, usually 0
    • select disk 0
    • list partition Look for a "Primary parition"
  • select partition 6 partition 6 in my case, but usually 0
@JohnRTitor
JohnRTitor / git-tricks.md
Last active July 3, 2024 09:56
Force push and interactive rebasing and amend

Interactive rebase (for squash, edit/amend, reword/rename, drop/remove):

git rebase --interactive HEAD~2

After a rebase like this, always force push

git fetch upstream
git rebase upstream/master
git push --force-with-lease
@JohnRTitor
JohnRTitor / plasma-file-picker-fix.md
Created January 23, 2024 08:28
GTK File Picker dialog shown in Plasma instead of QT

Edit /etc/environment

Add GTK_USE_PORTAL=1

Save Reboot

@JohnRTitor
JohnRTitor / solution.md
Last active April 3, 2024 18:12
Chrome Web Apps icons are not properly shown in Wayland

If Plasma Desktop is used with Wayland, using Chrome PWA (web apps) icon's are not properly shown in the task manager. PWAs would show up as additional windows under Chrome main entry in the Task Manager. A solution is to enable the Chrome flag, Preferred Ozone Platform and set it to Auto or Wayland. This will make Chrome run using Wayland completely, instead of relying on XWayland, which introduces bugs like these.

Type in browser address bar in Chrome: chrome://flags/#ozone-platform-hint

On NixOS, system wide Wayland support of Electron and Chromium apps can be enabled by setting the environment var

@JohnRTitor
JohnRTitor / overclock-display.md
Last active December 20, 2023 16:42
Overclock Display on Linux

For Wayland, you need to add a kernel parameter:

  1. Edit /etc/default/grub

  2. Add the following kernel parameter: video=HDMI-A-1:1920x1080@75

where HDMI-A-1 is the port of display output, 1920x1080 is the resolution, 75 is the refresh rate

  1. Run sudo update-grub