Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
@grim-reapper
grim-reapper / README_MINIMAL_PROMPT_CHAINABLE.md
Created July 3, 2024 18:15 — forked from disler/README_MINIMAL_PROMPT_CHAINABLE.md
Minimal Prompt Chainable for zero library sequential prompt chaining

Minimal Prompt Chainable

Sequential prompt chaining in one method with context and output back-referencing.

Files

  • main.py - start here - full example using MinimalChainable from chain.py to build a sequential prompt chian
  • chain.py - contains zero library minimal prompt chain class
  • chain_test.py - tests for chain.py, you can ignore this
  • requirements.py - python requirements

Setup

@grim-reapper
grim-reapper / filename-to-txt.bat
Created January 31, 2024 05:11 — forked from vizsumit/filename-to-txt.bat
This script generates .txt caption files from .jpg file names
@echo off
for %%i in (*.jpg) do (
set filename=%%i
set caption_filename=%%~ni.txt
set caption=%%~ni
setlocal EnableDelayedExpansion
for /f "tokens=1 delims=()" %%a in ("!caption!") do (
@grim-reapper
grim-reapper / .gitconfig
Created June 5, 2023 06:48 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@grim-reapper
grim-reapper / create-laravel-package.md
Created January 20, 2023 17:00 — forked from shankar-bavan/create-laravel-package.md
How to Build Laravel Package

Step #1: Install Laravel

Install the latest Laravel version i.e. Laravel 5.8. To do so go to the project directory and run the command:

composer create-project --prefer-dist laravel/laravel

Step #2: Create Package Directory

create folder from laravel root directory with this structure:

@grim-reapper
grim-reapper / example-wp-list-table.php
Created January 6, 2023 12:49 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@grim-reapper
grim-reapper / .htaccess
Created December 26, 2022 10:36 — forked from ankurk91/.htaccess
Some apache .htaccess tips and tricks
# Source internet
# Use at your own risk, test on localhost first
# Ovrride Default index.php
DirectoryIndex home.php
# Prevent access to some files
<FilesMatch "^(wp-config.php|readme.html|license.txt|README.md|.gitignore|.gitattributes|.htaccess|error_log)">
Order allow,deny
Deny from all
@grim-reapper
grim-reapper / bulk-convert.ps1
Created November 18, 2022 10:14 — forked from frozenex/bulk-convert.ps1
Bulk convert images to webp format using cwebp library in windows
# Copy this file to any directory containing images & then run this script in powershell
# Get all png images in the current directory & convert it to webp format
$images = Get-ChildItem -Path (Get-Location) -Filter *.png
foreach ($image in $images) {
$fileName = $image.DirectoryName + "\" + $image.BaseName + ".webp"
cwebp.exe -q 80 $image.FullName -o $fileName
}
@grim-reapper
grim-reapper / find.and.replace.sql
Created November 17, 2022 12:34 — forked from AndrewChamp/find.and.replace.sql
MySQL Find & Replace
UPDATE TABLE_NAME
SET COLUMN_NAME = REPLACE(COLUMN_NAME, 'string/to/find', 'string/to/replace')
# OPTIONAL: Replaces embedded strings
WHERE COLUMN_NAME LIKE ('%string_to_find%');
# SEARCH DATABASE TABLES FOR COLUMN NAME
SELECT
table_name,
column_name,
data_type,
ordinal_position
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
@grim-reapper
grim-reapper / optimize.php
Created November 17, 2022 10:56 — forked from fians/optimize.php
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/