Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Mattias mattiasghodsian

🏠
Working from home
Block or report user

Report or block mattiasghodsian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattiasghodsian
mattiasghodsian / unzip.bat
Created Jan 18, 2020
UnRAR/UnZip files in sub directory's + rename + move
View unzip.bat
::Title: UnRAR/UnZip files in sub directory's + rename + move
::Author: Mattias Ghodsian
::Donate a cup of coffee: https://www.paypal.me/MattiasG
::Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
SETLOCAL ENABLEEXTENSIONS
FOR /D /r %%F in ("*") DO (
pushd %CD%
cd %%F
@mattiasghodsian
mattiasghodsian / functions.php
Created Dec 23, 2019
[WooCommerce] Add missing Schema
View functions.php
/**
* Title: Add missing Schema WooCommerce
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
**/
function woo_missing_schema_fields($data) {
global $product;
@mattiasghodsian
mattiasghodsian / readme.md
Last active Dec 19, 2019
[Wordpress] Manually backup WordPress
View readme.md

Export database with wp-cli

SSH to your site and go to the root folder of the WordPress installation and do

wp db export

Compress site

Move outside the root folder of WordPress and compress the folder (The db fils is located in the root folder and will be included).

@mattiasghodsian
mattiasghodsian / functions.php
Created Dec 18, 2019
[Wordpress] SVG upload
View functions.php
/**
* Title: SVG upload
* Author: Mattias Ghodsian
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
**/
add_filter( 'upload_mimes', 'cc_mime_types' );
function cc_mime_types( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
@mattiasghodsian
mattiasghodsian / functions.php
Created Dec 11, 2019
Set custom min/max value for Single Slider in FacetWP
View functions.php
/**
* Set custom min/max value for Single Slider in FacetWP (Replace ID-HERE)
*
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
**/
add_filter( 'facetwp_render_output', function( $output, $params ) {
if ( isset( $output['settings']['ID-HERE'] ) ) {
$output['settings']['ID-HERE']['range'] = [
'min' => [0],
@mattiasghodsian
mattiasghodsian / size.js
Created Dec 3, 2019
Get Window Width and Height on resize
View size.js
/**
* Donate a cup of coffee: https://www.paypal.me/MattiasG
* Donate Eth: 0xBBB96204E45D11C9799c6B12E6eE6F0d4A071Ef5
*/
$(window).resize(function () {
windowWidth = $(window).outerWidth();
windowHeight = $(window).height();
booking_height = $('#element').outerHeight();
scrollpos = $('.grid').height() + 85;
View thumbnails.ps1
Write-Host "################################ `n### Thumbnail generator by https://github.com/mattiasghodsian ### `n################################`n" -ForegroundColor Red
./ffmpeg -y -ss 00:00:10 -i input.mp4 -frames 1 -vf "drawtext=text='%{pts\:hms}': x=(w-tw)-20: y=(h-th)-20: fontcolor=white: fontsize=43: shadowcolor=black:shadowx=2:shadowy=2,fps=1/10,scale=-1:120,tile=4x4" out.png
start out.png
PAUSE
View tv-rename.ps1
Write-Host "################################ `n### TV File renamer by https://github.com/mattiasghodsian ### `n################################`n" -ForegroundColor Red
$series = Read-Host -Prompt 'Enter Series name (no end space)'
Write-Host "Set $series" -ForegroundColor Red -BackgroundColor Yellow
$season = Read-Host -Prompt 'Enter Season (example 01)'
Write-Host "Set $season" -ForegroundColor Red -BackgroundColor Yellow
Write-Host "Processing"
$path = Get-Location
$int = 1
Get-ChildItem -Path $path -Recurse -Exclude *.ps1,*.zip -Filter "*" -file | %{
@mattiasghodsian
mattiasghodsian / hello.sh
Last active Dec 3, 2019
Terminal Welcome message
View hello.sh
#!/bin/bash
# vars
os=$(lsb_release -sd)
codename=$(lsb_release -sc)
id=$(lsb_release -si)
pubip=$(dig @resolver1.opendns.com A myip.opendns.com +short -4)
locip=$(hostname -I | cut -d " " -f1)
ut=$(awk '{print int($1/86400)"days "int($1%86400/3600)":"int(($1%3600)/60)":"int($1%60)}' /proc/uptime)
qt=$(fortune -n 25 -s)
@mattiasghodsian
mattiasghodsian / readme.md
Created Nov 6, 2019
How to install and use youtube-dl
View readme.md

Ever needed a tutorial or just download non copyrighted material from YouTube to watch or listen offline?

YouTube-dl is a command-line tool which is open source and can be used to download videos from YouTube, Facebook, and other popular sites, see the full list here.


NOTE: Keep in mind some media contains copyrighted material.


You can’t perform that action at this time.