Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mattias mattiasghodsian

🏠
Working from home
  • /home/mattias
View GitHub Profile
@mattiasghodsian
mattiasghodsian / readme.md
Last active Jul 27, 2021
Install flameshot and bind to Prt Sc key on Ubuntu 20.04
View readme.md

Install flameshot

Remove current bind on Prt Sc key

gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot '[]'

Bind flameshot by going to Setttings > Keyboard Shortcuts and then scroll all the way down and press the +

@mattiasghodsian
mattiasghodsian / readme.md
Created Jul 13, 2021
Turn off .NET SDK telemetry On Debian/Ubuntu
View readme.md
"The .NET SDK includes a telemetry feature that collects usage data and exception information when the .NET 
CLI crashes. The .NET CLI comes with the .NET SDK and is the set of verbs that enable you to build, test, 
and publish your .NET apps. It's important that the .NET team understands how the tools are used so they 
can be improved. Information on failures helps the team resolve problems and fix bugs."

The .NET SDK telemetry feature is enabled by default but should be prompt witch Yes/No while setting up. To turn off Telemetry open up the terminal and run

@mattiasghodsian
mattiasghodsian / readme.md
Created May 10, 2021
Setup RAIDZ on Ubuntu Server 20.04 LTS
View readme.md

Setup RAIDZ on Ubuntu Server 20.04 LTS

In this walkthrough we'll be using 4 brand new Seagate IronWolf Pro 10TB 7200rpm 256MB hard drives to setup a ZFS storage pool (RAIDZ 10).

1. ZFS

If you don't have ZFS already installed go ahead and run

sudo apt install zfsutils-linux

2. Disk Identifier & Sector sizes

Before we do anything with the drives we need the disk identifier and sector size for each drive for step 3.

View .bash_aliases
###########################################################################
# #
# ------- Aliases -------- #
# --------- #
# ------- https://gist.github.com/mattiasghodsian ------- #
# #
# # Usage: #
# dpanic : FBI panic remove containers (0.0) #
# dex <container>: execute shell inside <container> #
# dnames : names of all running containers #
@mattiasghodsian
mattiasghodsian / readme.md
Last active Jun 16, 2021
Valheim Dedicated Server Setup on Ubuntu 20.04.1 LTS
View readme.md

Port forwarding

Open ports (udp)

2456 2457 2458 27060

Uncomplicated Firewall

sudo ufw allow 2456/udp
@mattiasghodsian
mattiasghodsian / readme.md
Last active Mar 15, 2021
Install Go Lang on Ubuntu/Pop!_OS 20.04 LTS (zsh)
View readme.md

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 Dec 12, 2020
[Wordpress] Fix Password Protect pages with Elementor
View functions.php
/**
* Fix Password Protect pages with Elementor
*
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*
* @param string $content
* @return html
*/
@mattiasghodsian
mattiasghodsian / functions.php
Created Dec 3, 2020
[Wordpress] Bootstrap 4+ Pagination
View functions.php
/**
* Bootstrap 4+ Pagination for Wordpress
*
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*
* @param integer $paged
* @param integer $max_num_pages
* @param string $wrap_classe
@mattiasghodsian
mattiasghodsian / functions.php
Created Nov 4, 2020
[Wordpress] Modify the page title (<title>)
View functions.php
/**
* Modify the page title (<title>)
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* 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
Created Nov 4, 2020
[Woocommece] Add Author to WooCommerce Products
View functions.php
/**
* Add Author to WooCommerce Products
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
add_action('init', 'add_author_support_woocommerce', 999 );
function add_author_support_woocommerce() {
add_post_type_support( 'product', 'author' );
}