Skip to content

Instantly share code, notes, and snippets.

View matinrco's full-sized avatar
🤔
Thinkering... 😁

Matin matinrco

🤔
Thinkering... 😁
View GitHub Profile
@matinrco
matinrco / fixQtThemesOnGtkDesktops.md
Last active May 20, 2021 09:43
Fix QT Themes on GTK Desktops

In Gnome, use these libs and command to make QT apps follow GTK theming better:

sudo apt install qt5-style-plugins
sudo bash -c "echo 'QT_QPA_PLATFORMTHEME=gtk2' >> /etc/environment"
@matinrco
matinrco / winLocalhostToWslLocalhost.md
Last active October 1, 2021 11:49
Access windows service inside WSL2 via localhost:port

Install socat :

sudo apt install socat

then :

socat -d -d TCP-LISTEN:8080,reuseaddr,fork,bind=localhost TCP:$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):1080

here I make windows service running at 1080 port number accessible within WSL2 localhost:8080 (e.g proxy running on windows)

@matinrco
matinrco / gitProxy.md
Last active June 15, 2025 07:10
Configure git/ssh to use socks/http proxy in windows, linux & wsl2

Windows

Add this to your ssh config file ( which is located in %USERPROFILE%\.ssh\config ) or create one if it's missing:

Http proxy & repo access via ssh:

Host *
    ProxyCommand "C:/Program Files/Git/mingw64/bin/connect.exe" -H {proxyserver}:{port} %h %p

or (for specific host name)

Host gitlab.com
@matinrco
matinrco / podmanOnDebianWSL.md
Last active October 5, 2022 02:19
Setting up Podman on WSL2 (Debian 10/buster) in Windows 10
  • Load OS related variables into shell:
    . /etc/os-release
    
  • Add repo:
    sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
    
  • Add apt key:
@matinrco
matinrco / graphLookup.js
Last active March 27, 2024 16:05
Brief example of MongoDB graphLookup to work with tree structure such as e-commerce product categories
// Insert some data
db.product_categories.insertMany([
{
_id: 1,
name: 'Products',
parent_id: null
},
{
_id: 2,
name: 'Digital & Electronics',
@matinrco
matinrco / hideGrubMenu.md
Created October 1, 2020 14:39
Hide grub menu to fix flickerfree boot on fedora

How to enable hidden GRUB menu?

On new Fedora 29 Workstation installs this will be enabled by default. If your system has been upgraded to F29 from an older release, you can enable it by running these commands:

On a system using UEFI booting ("ls /sys/firmware/efi/efivars" returns a bunch of files):

sudo grub2-editenv - set menu_auto_hide=1
sudo grub2-mkconfig -o /etc/grub2-efi.cfg

On a system using legacy BIOS boot:

Remove old kernels & modules & headers with dnf in fedora

List installed kernels

rpm -qa kernel* |sort -V

exmple output:

kernel-5.6.6-300.fc32.x86_64
kernel-5.8.11-200.fc32.x86_64
@matinrco
matinrco / mongodbOnDebianWSL.md
Last active February 4, 2023 06:21
Install MongoDB 4.4.1 on Windows 10 WSL 2 (Debian 10/Buster - Ubuntu 20.04 LTS (Focal Fossa))

Run OpenModelica GUI with Docker on Mac OS host

  1. First you need docker , brew , XQuartz and socat on your host.

    • docker : Install docker desktop from here
    • brew : Follow installation instruction from here
    • XQuartz : Install by : brew cask install xquartz
    • socat : Install by : brew install socat
  2. Now run this in new terminal :

socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY"

@matinrco
matinrco / usbLTEtoEthernet.md
Last active April 11, 2020 12:26
Raspberry pi - Huawei HiLink (E8372 LTE usb dongle) to ethernet adapter - tested on raspbian buster
  1. Set static ip address to raspberry pi eth0 (ethernet) in /etc/network/interfaces.d/eth0 :

    auto eth0
    iface eth0 inet static
        address 192.168.1.20/24
  2. Uncomment IP forwarding from /etc/sysctl.conf :

net.ipv4.ip_forward=1