Skip to content

Instantly share code, notes, and snippets.

View Edwardtonnn's full-sized avatar
🎯
Focusing

Edward Edwardtonnn

🎯
Focusing
  • Los Angeles Web Club
  • South Gate, CA
View GitHub Profile
@Edwardtonnn
Edwardtonnn / rename.sh
Created May 20, 2024 22:03
sequence rename 01 02 03
n=1; for file in *.jpg; do mv "$file" $(printf "%02d.jpg" $n); n=$((n + 1)); done
@Edwardtonnn
Edwardtonnn / split.sh
Created May 20, 2024 22:00
Split images down the middle using image magick
find . -name '*.jpg' -exec sh -c 'convert "$0" -crop 50%x100% +repage +adjoin "${0%.jpg}_%d.jpg"' {} \;
@Edwardtonnn
Edwardtonnn / renameImages.bash
Created April 15, 2024 17:23
Renames all images in the directory 01.jpg 02.jpg 03.jpg
cmd /v:on /c "set i=0 & for %f in (*.jpg) do (set /a i+=1 & set "num=00!i!" & set "num=!num:~-2!" & ren "%f" "!num!.jpg")"
@Edwardtonnn
Edwardtonnn / gallery.scss
Last active April 4, 2024 16:45
Alt Gallery SCSS
@Edwardtonnn
Edwardtonnn / rename.ps1
Created February 26, 2024 22:05
rename all images in all folders 01 02 03 etc in
Get-ChildItem -Directory | ForEach-Object {
$Folder = $_
$i = 1
Get-ChildItem $Folder -File | ForEach-Object {
$NewName = "{0:D2}.jpg" -f $i++
# Check if the file is already named correctly
if ($_.Name -ne $NewName) {
$NewPath = Join-Path $Folder.FullName $NewName
# Check if a file with the new name already exists to avoid overwriting
if (-Not (Test-Path $NewPath)) {
@Edwardtonnn
Edwardtonnn / index.html
Created February 9, 2024 19:07
emmet for using the same value
option[value=$#]*>{$#}
@Edwardtonnn
Edwardtonnn / delete.py
Created January 11, 2024 22:34
Python script to search a dirctory of galleries to find an even number of images. If dir does not have an even number of images it deletes the last one. The idea behind this script was to find trash images since before and after are always even.
import os
import glob
# Replace this with your directory path
base_directory = "./body/corrective-body-contouring/"
# Loop through each folder in the directory
for folder in os.listdir(base_directory):
folder_path = os.path.join(base_directory, folder)
@Edwardtonnn
Edwardtonnn / duplicates.ps1
Created December 14, 2023 19:30
Removes duplicates from SEO Title
# Define the path to the root of your PHP projects
$rootPath = "./"
# Define the file pattern to search for
$filePattern = "*.php"
# Function to fix the SEO title in a file
function Fix-SeoTitle {
param (
[string]$filePath
@Edwardtonnn
Edwardtonnn / dir-to-json.py
Created December 11, 2023 22:45
Python script to output all dir into json file
import os
import json
# Specify the directory you want to search in
directory_path = "./"
# Function to list all folders in a directory
def list_folders(directory):
folder_list = []
for root, dirs, files in os.walk(directory):
@Edwardtonnn
Edwardtonnn / reverse-folders.ps1
Last active January 11, 2024 22:23
Reverses dir folder names. Used for gallery reversals. Paste into powershell and hit enter
# Get the list of directories in the current folder
$directories = Get-ChildItem -Directory | Sort-Object Name
# Temporary name for renaming
$tempName = "tempDir"
# Rename directories to temporary names in reverse order
for ($i = 0; $i -lt $directories.Count; $i++) {
$newName = "{0:D2}" -f ($directories.Count - $i)
Rename-Item $directories[$i].Name $tempName$newName