Skip to content

Instantly share code, notes, and snippets.

View ibrahimmkhalid's full-sized avatar

Ibrahim Mansoor Khalid ibrahimmkhalid

View GitHub Profile
@ibrahimmkhalid
ibrahimmkhalid / copybase.bat
Created June 2, 2025 23:22
Copies a folder named "base" to a user provided folder
@echo off
setlocal
rem Define the base folder name
set "baseFolder=base"
rem Check if the base folder exists
if not exist "%baseFolder%" (
echo Error: The source folder "%baseFolder%" does not exist.
pause
@ibrahimmkhalid
ibrahimmkhalid / DuplicateSheetBasedOnPreviousSheet.vba
Created June 9, 2022 18:48
Simple Excel VBA script to make a duplicate sheet in main workbook in excel. Sheet names are simple numbers and each subsequent sheet references the previous sheet somehow
Public Sub DuplicateSheetBasedOnPreviousSheet()
Dim OldName As String
Dim PrevName As String
Dim OldNum As Integer
Dim NewName As String
OldName = ActiveSheet.Name
OldNum = CInt(OldName)
PrevName = CStr(OldNum - 1)
NewName = CStr(OldNum + 1)
ActiveSheet.Copy after:=Sheets(Sheets.Count)
@ibrahimmkhalid
ibrahimmkhalid / unstitch.py
Last active April 30, 2020 15:20
unstitch an image into its parts. Usage: python unstitch.py src.png <number of cuts along width> <number of cuts along height>
from PIL import Image
import sys
src = Image.open(sys.argv[1])
num_x = int(sys.argv[2])
num_y = int(sys.argv[3])
new_x = src.size[0]/num_x
new_y = src.size[1]/num_y
for xx in range(0, num_x):
@ibrahimmkhalid
ibrahimmkhalid / tessellator.py
Created February 17, 2020 14:16
create tesselation of any image. Usage: python tessellator.py src.png copies_x copies_y
from PIL import Image
import sys
src = Image.open(sys.argv[1])
copies_x = int(sys.argv[2])
copies_y = int(sys.argv[3])
new_name = str(sys.argv[1])[:-4] + '_x' + str(copies_x) + '_y' + str(copies_y) + '.png'
new_x = copies_x * src.size[0]
new_y = copies_y * src.size[1]
new_image = Image.new('RGB', (new_x, new_y), color=(255,255,255))