Skip to content

Instantly share code, notes, and snippets.

View thoriqmacto's full-sized avatar
🎯
Focusing

Thariq thoriqmacto

🎯
Focusing
View GitHub Profile
@thoriqmacto
thoriqmacto / audioviz_overlay.sh
Last active June 18, 2022 14:53
Script to run FFMPEG overlay audio-viz to picture.
#! /bin/sh
ifn="[slug_name]"
pref="`basename $0 .sh`"
fpathaudio="in/${ifn}.mp3"
fpathpic="in/${ifn}.jpg"
# RUN FFMPEG SCRIPT
./ffmpeg -y -i "${fpathaudio}" -i "${fpathpic}" -filter_complex "
[0:a]showwaves=s=640x150:mode=cline:colors=red,colorkey=0x000000:0.01:0.1,format=yuva420p[v];
@thoriqmacto
thoriqmacto / node_cmd_in_windows_powershell.js
Last active August 1, 2023 14:06
Compilations of node commands in windows powershell terminal.
// To set NODE_ENV to some variables
$env:NODE_ENV="production"
// To run node server with NODE_DEBUG
$env:NODE_DEBUG="server";node index.js
@thoriqmacto
thoriqmacto / .gitignore
Created November 15, 2023 15:38
.gitignore template for ideaProject
# IDE related files
.idea/
*.iml
*.iws
*.ipr
# Build output
out/
target/
build/
@thoriqmacto
thoriqmacto / ExportTableToSQL.bas
Last active December 5, 2023 15:30
VBA code that loops through an Excel table and generates SQL INSERT statements based on the data
Sub ExportTableToSQL()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim ws As Worksheet
Dim wsName As String
wsName = "your_worksheet_name" 'Replace with your sheet name
Set ws = wb.Sheets(wsName)
ws.Select
@thoriqmacto
thoriqmacto / ExportTableToPipeSeparated.bas
Last active December 9, 2023 15:12
VBA code that loops through an Excel table and generates list separated by "|" statements based on the data.
Sub ExportTableToPipeSeparated()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim ws As Worksheet
Dim wsName As String
wsName = "your_worksheet_name" 'Replace with your sheet name
Set ws = wb.Sheets(wsName)
ws.Select
@thoriqmacto
thoriqmacto / GenerateChecksheetByLoop.bas
Created January 30, 2024 06:16
Sub-routine to generate checksheet associated with the loop in new sheet. There is lookup table that consist of all information for loop to checksheets relationship.
Sub GenerateChecksheetByLoop()
' Define the source worksheet
Dim sourceSheet As Worksheet
Set sourceSheet = ActiveSheet ' You can change this to the specific sheet
' Define the selected range
Dim selectedRange As Range
On Error Resume Next
Set selectedRange = Application.InputBox("Select the range containing Loop Name and Count", Type:=8)
On Error GoTo 0
@thoriqmacto
thoriqmacto / wpessential_filter_hooks.php
Created April 17, 2024 11:15
Implement essential admin hooks settings features for WordPress.
<?php
/**
* Plugin Name: WP Essential Filter Hooks
* Description: Implement essential admin hooks settings features for WordPress.
* Version: 1.0
* Author: macto
*/
// Add "Duplicate" Button for Pages and Posts
function custom_duplicate_button($actions, $post) {
@thoriqmacto
thoriqmacto / custom-block-variation.js
Created April 17, 2024 11:17
Wordpress block variation registration code for post-featured-image to include caption automatically.
// Define the custom block variation
wp.blocks.registerBlockVariation(
'core/post-featured-image', // Base block type
{
name: 'sotp/post-featured-image', // Variation name
title: 'Post Featured Image + Caption', // Variation title
description: 'Displays the post\'s featured image with caption.', // Variation description
attributes: {
namespace: 'sotp_post_featured_image', // Custom attribute namespace
className: 'sotp-post-featured-image' // Custom class name
@thoriqmacto
thoriqmacto / LookupEmptyDatesFormat.bas
Last active August 16, 2025 05:52
Excel formula to returning empty/blank or "" when date is null
=IFERROR(
LET(r,INDEX(Master[Date],MATCH($A2,Master[Key],0)),
IF(OR(r="",r=0),"",r)
),
"")