Skip to content

Instantly share code, notes, and snippets.

View markshust's full-sized avatar
🤓
Working on educational & training material for Magento 2

Mark Shust markshust

🤓
Working on educational & training material for Magento 2
View GitHub Profile
@markshust
markshust / translate.py
Last active March 8, 2023 22:14
Python script to use Whisper to transcribe audio/video
import os
import whisper
from whisper.utils import get_writer
input_dir = 'input/'
output_dir = 'output/'
for filename in sorted(os.listdir(input_dir)):
if filename.endswith('.mp4'):
input_file = input_dir + filename
@markshust
markshust / file1
Created October 12, 2022 15:43
Here is a my gist
content
@markshust
markshust / genhtml.sh
Last active July 16, 2022 15:11
Generate HTML/markup from folder full of course videos
#!/bin/bash
course="php-101"
totalcount=0
for i in *.mp4; do
[[ $i == *"- clean"* ]] && continue
totalcount=$((totalcount+1))
done;
@markshust
markshust / genthumbs.sh
Created July 16, 2022 05:39
Generate video thumbnails at 15 sec timestamp from directory of MP4 files
#!/bin/bash
for i in *.mp4; do
[[ $i == *"- clean"* ]] && continue # this line excludes files that contain "- clean" in filename
prefix=`echo "$i" | sed "s/^\([0-9]*\)\.\(.*\)/\1/"`;
ffmpeg -i "$i" -ss 00:00:15.00 -vf "thumbnail,scale=480:270" -frames:v 1 "$prefix.webp"
done
@markshust
markshust / ViewModel\FilteredAttribute.php
Last active July 8, 2022 18:09
Get specific attribute data for the current product with a ViewModel
<?php declare(strict_types=1);
namespace Macademy\ProductInfo\ViewModel;
use Magento\Catalog\Model\ProductRepository;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\View\Element\Block\ArgumentInterface;
class FilteredAttribute implements ArgumentInterface
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="other_settings">
<fieldset name="head">
<field name="head_includes">
<settings>
<disabled>true</disabled>
</settings>
</field>
</fieldset>
@markshust
markshust / Api\Data\PostSearchResultInterface.php
Last active June 19, 2022 16:54
Search result interface implementation
<?php declare(strict_types=1);
namespace Macademy\Blog\Api\Data;
use Macademy\Blog\Api\Data\PostInterface;
use Magento\Framework\Api\SearchResultsInterface;
/**
* Blog post search result interface.
* @api
@markshust
markshust / view\frontend\layout\default.xml
Created June 17, 2022 12:20
Add a JavaScript file to all pages of Magento with head.link node
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Foo_Bar::js/my-js-file.js"/>
</head>
</page>
@markshust
markshust / adobe-cloud-magerun-dev-console.sh
Created April 26, 2022 14:33 — forked from vbuck/adobe-cloud-magerun-dev-console.sh
Use N98-Magerun Dev Console in Adobe Cloud Environments
cd /tmp
curl -O https://files.magerun.net/n98-magerun2.phar
chmod +x ./n98-magerun2.phar
XDG_CONFIG_HOME="/tmp" ./n98-magerun2.phar dev:console --root-dir=$MAGENTO_CLOUD_DIR
@markshust
markshust / keybase.md
Created March 10, 2022 18:02
keybase.md

Keybase proof

I hereby claim:

  • I am markshust on github.
  • I am markshust (https://keybase.io/markshust) on keybase.
  • I have a public key ASAl4N1-B72cg7xyoNwDOiw6IiuhGbFYYi-8SssbIiA6owo

To claim this, I am signing this object: