Skip to content

Instantly share code, notes, and snippets.

View mattiasghodsian's full-sized avatar
🏠
Working from home

mattiasghodsian

🏠
Working from home
View GitHub Profile
@mattiasghodsian
mattiasghodsian / readme.md
Last active April 25, 2024 14:39
Valheim Dedicated Server Setup on Ubuntu 20.04.1 LTS

Port forwarding

Open ports (udp)

2456 2457 2458 27060

Uncomplicated Firewall

sudo ufw allow 2456/udp
@mattiasghodsian
mattiasghodsian / readme.md
Last active May 3, 2024 20:36
Install Go Lang on Ubuntu/Pop!_OS 20.04 LTS (zsh)

Install Go Lang on Ubuntu/Pop!_OS 20.04 LTS (zsh)

  • Get Go lang from golang.org
  • Extract the archive sudo tar -xvf go1.15.6.linux-amd64.tar.gz
  • Move the go directory to /usr/local directory sudo mv go /usr/local
  • Add global variable to your shell (zsh) nano ~/.zshrc
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:25
[Wordpress] Fix Password Protect pages with Elementor
/**
* Fix Password Protect pages with Elementor
*
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*
* @param string $content
* @return html
*/
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:31
[Wordpress] Bootstrap 4+ Pagination
/**
* Bootstrap 4+ Pagination for Wordpress
*
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*
* @param integer $paged
* @param integer $max_num_pages
* @param string $wrap_classe
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:32
[Wordpress] Modify the page title (<title>)
/**
* Modify the page title (<title>)
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
add_filter('wp_title', 'filter_page_title', 99);
add_filter( 'bloginfo', 'filter_page_title', 10, 2 );
function filter_page_title($title) {
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:32
[Woocommece] Add Author to WooCommerce Products
/**
* Add Author to WooCommerce Products
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
add_action('init', 'add_author_support_woocommerce', 999 );
function add_author_support_woocommerce() {
add_post_type_support( 'product', 'author' );
}
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:32
[Wordpress] Add more users to Auther box
/**
* Add more users to Auther box
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
add_filter('wp_dropdown_users', 'add_users_to_dropdown_users');
function add_users_to_dropdown_users()
{
global $post; // remove if not needed
@mattiasghodsian
mattiasghodsian / importer.php
Last active April 28, 2023 08:32
[Wordpress] Custom importer class
<?php
/**
* FM_Importer
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
@mattiasghodsian
mattiasghodsian / readme.md
Last active September 4, 2020 18:20
How to install Sonarr,Jackett,qBittorrent and mount network drive on Raspberry PI 4

~|~ I DO NOT INDORCE TORRENTING COPYRIGHT CONTENT - THIS IS MADE FOR EDUCATIONAL PURPOSES ONLY ~|~

1. Setup your Raspberry

  • Install Raspberry OS headless on your SD card and power it up with a screen, ether cable and keyboard
  • Enable SSH with sudo raspi-config and go to Interfaces and enable SSH
  • Change the password with Option one sudo raspi-config
  • sudo apt-get update then sudo apt-get upgrade -y

2. Install qbittorrent-nox

  • sudo apt-get update && sudo apt-get install qbittorrent-nox
@mattiasghodsian
mattiasghodsian / functions.php
Last active April 28, 2023 08:33
[WordPress] Get field data by field ID gravity forms
/**
* gf_get_field_data
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.buymeacoffee.com/mattiasghodsian
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*
* @param int $form_id
* @param int $id the field integer key
* @param str $key what value to return
* @return string/boolean