From 21bd83aed065601dc906fee802ae4921ccc22e3e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 21:15:34 +0000 Subject: [PATCH 1/3] Initial plan From d087208f097f710c95169ddf8894cc33f8871177 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 21:21:29 +0000 Subject: [PATCH 2/3] Implement core text transformation scripts for Unix and Windows Co-authored-by: stringsn88keys <252056+stringsn88keys@users.noreply.github.com> --- README.md | 152 +++++++++++++++++++++++++++++++++++++- unix/rage_flip.sh | 74 +++++++++++++++++++ unix/sarcasm.sh | 64 ++++++++++++++++ unix/strikethrough.sh | 56 ++++++++++++++ unix/underline.sh | 56 ++++++++++++++ unix/word_flip.sh | 56 ++++++++++++++ windows/RageFlip.ps1 | 65 ++++++++++++++++ windows/Sarcasm.ps1 | 52 +++++++++++++ windows/Strikethrough.ps1 | 45 +++++++++++ windows/Underline.ps1 | 45 +++++++++++ windows/WordFlip.ps1 | 38 ++++++++++ 11 files changed, 702 insertions(+), 1 deletion(-) create mode 100755 unix/rage_flip.sh create mode 100755 unix/sarcasm.sh create mode 100755 unix/strikethrough.sh create mode 100755 unix/underline.sh create mode 100755 unix/word_flip.sh create mode 100644 windows/RageFlip.ps1 create mode 100644 windows/Sarcasm.ps1 create mode 100644 windows/Strikethrough.ps1 create mode 100644 windows/Underline.ps1 create mode 100644 windows/WordFlip.ps1 diff --git a/README.md b/README.md index 7ecb944..17ac626 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,152 @@ # script_flips -Collection of macOS, Windows, and Linux scripts to decorate text +Collection of macOS, Windows, and Linux scripts to decorate text with Unicode transformations that automatically copy results to the clipboard. + +## Features + +Transform your text with these fun Unicode effects: +- **Rage Flip** - Turn text upside-down (ɹǝʌǝɹsǝp) +- **Word Flip** - Reverse word order +- **Underline** - Add Unicode underlines (u̲n̲d̲e̲r̲l̲i̲n̲e̲) +- **sArCaSm** - Alternating case (sArCaStIc) +- **Strikethrough** - Add Unicode strikethrough (s̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶) + +All scripts automatically copy the transformed text to your system clipboard! + +## Installation + +### Linux/macOS (Unix-like systems) + +1. Clone the repository: +```bash +git clone https://github.com/stringsn88keys/script_flips.git +cd script_flips +``` + +2. Make scripts executable: +```bash +chmod +x unix/*.sh +``` + +3. For clipboard functionality on Linux, install one of: +```bash +# Ubuntu/Debian +sudo apt install xclip +# or +sudo apt install xsel +# or for Wayland +sudo apt install wl-clipboard + +# Fedora/RHEL +sudo dnf install xclip +# or +sudo dnf install xsel + +# Arch Linux +sudo pacman -S xclip +# or +sudo pacman -S xsel +``` + +### Windows (PowerShell) + +1. Clone the repository or download the PowerShell scripts from the `windows/` folder +2. Scripts are ready to use (PowerShell 5.0+ required) + +## Usage + +### Linux/macOS Scripts + +```bash +# Rage flip (upside-down text) +./unix/rage_flip.sh "Hello World!" +# Output: ¡plɹoM ollǝH + +# Word flip (reverse word order) +./unix/word_flip.sh "Hello World Everyone" +# Output: Everyone World Hello + +# Underline text +./unix/underline.sh "Hello World!" +# Output: H̲e̲l̲l̲o̲ W̲o̲r̲l̲d̲!̲ + +# sArCaSm text +./unix/sarcasm.sh "This is so cool" +# Output: ThIs Is So CoOl + +# Strikethrough text +./unix/strikethrough.sh "Hello World!" +# Output: H̶e̶l̶l̶o̶ W̶o̶r̶l̶d̶!̶ +``` + +### Windows PowerShell Scripts + +```powershell +# Rage flip (upside-down text) +.\windows\RageFlip.ps1 "Hello World!" +# Output: ¡plɹoM ollǝH + +# Word flip (reverse word order) +.\windows\WordFlip.ps1 "Hello World Everyone" +# Output: Everyone World Hello + +# Underline text +.\windows\Underline.ps1 "Hello World!" +# Output: H̲e̲l̲l̲o̲ W̲o̲r̲l̲d̲!̲ + +# sArCaSm text +.\windows\Sarcasm.ps1 "This is so cool" +# Output: ThIs Is So CoOl + +# Strikethrough text +.\windows\Strikethrough.ps1 "Hello World!" +# Output: H̶e̶l̶l̶o̶ W̶o̶r̶l̶d̶!̶ +``` + +## Examples + +Transform "Hello World!" with different effects: + +| Effect | Result | +|--------|--------| +| Original | Hello World! | +| Rage Flip | ¡plɹoM ollǝH | +| Word Flip | World! Hello | +| Underline | H̲e̲l̲l̲o̲ W̲o̲r̲l̲d̲!̲ | +| sArCaSm | HeLlO WoRlD! | +| Strikethrough | H̶e̶l̶l̶o̶ W̶o̶r̶l̶d̶!̶ | + +## Directory Structure + +``` +script_flips/ +├── unix/ # Linux/macOS bash scripts +│ ├── rage_flip.sh +│ ├── word_flip.sh +│ ├── underline.sh +│ ├── sarcasm.sh +│ └── strikethrough.sh +├── windows/ # Windows PowerShell scripts +│ ├── RageFlip.ps1 +│ ├── WordFlip.ps1 +│ ├── Underline.ps1 +│ ├── Sarcasm.ps1 +│ └── Strikethrough.ps1 +└── README.md +``` + +## Technical Details + +- **Unicode Support**: Uses Unicode combining characters and special Unicode symbols +- **Clipboard Integration**: Automatically copies results to system clipboard +- **Cross-Platform**: Native implementations for Linux/macOS (bash) and Windows (PowerShell) +- **No Dependencies**: Works with standard system tools (except clipboard utilities on Linux) + +## Supported Platforms + +- **Linux**: Any distribution with bash (clipboard requires xclip, xsel, or wl-clipboard) +- **macOS**: Built-in clipboard support via pbcopy +- **Windows**: PowerShell 5.0+ with built-in clipboard support + +## License + +MIT License - see [LICENSE](LICENSE) file for details. diff --git a/unix/rage_flip.sh b/unix/rage_flip.sh new file mode 100755 index 0000000..7be75c8 --- /dev/null +++ b/unix/rage_flip.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# Rage flip (upside-down text) using Unicode + +# Unicode mapping for upside-down characters +declare -A flip_map=( + ['a']='ɐ' ['b']='q' ['c']='ɔ' ['d']='p' ['e']='ǝ' ['f']='ɟ' ['g']='ƃ' ['h']='ɥ' + ['i']='ᴉ' ['j']='ɾ' ['k']='ʞ' ['l']='l' ['m']='ɯ' ['n']='u' ['o']='o' ['p']='d' + ['q']='b' ['r']='ɹ' ['s']='s' ['t']='ʇ' ['u']='n' ['v']='ʌ' ['w']='ʍ' ['x']='x' + ['y']='ʎ' ['z']='z' + ['A']='∀' ['B']='ᗺ' ['C']='Ɔ' ['D']='ᗡ' ['E']='Ǝ' ['F']='ᖴ' ['G']='פ' ['H']='H' + ['I']='I' ['J']='ſ' ['K']='ʞ' ['L']='˥' ['M']='W' ['N']='N' ['O']='O' ['P']='Ԁ' + ['Q']='Q' ['R']='ᴿ' ['S']='S' ['T']='┴' ['U']='∩' ['V']='Λ' ['W']='M' ['X']='X' + ['Y']='⅄' ['Z']='Z' + ['0']='0' ['1']='Ɩ' ['2']='ᄅ' ['3']='Ɛ' ['4']='ㄣ' ['5']='ϛ' ['6']='9' ['7']='ㄥ' + ['8']='8' ['9']='6' + ['!']='¡' ['?']='¿' ['.']='˙' [',']="'" [';']='؛' [':']=':', ['(']=')' + [')']='(' ['[']='[' [']']='[' ['{']='}' + [' ']=' ' +) + +rage_flip_text() { + local input="$1" + local result="" + local char + local flipped_char + + # Reverse the string and flip each character + for (( i=${#input}-1; i>=0; i-- )); do + char="${input:$i:1}" + flipped_char="${flip_map[$char]}" + if [[ -n "$flipped_char" ]]; then + result+="$flipped_char" + else + result+="$char" + fi + done + + echo "$result" +} + +# Check if text is provided as argument +if [[ $# -eq 0 ]]; then + echo "Usage: $0 \"text to flip\"" + echo "Example: $0 \"Hello World!\"" + exit 1 +fi + +# Process the input text +input_text="$*" +flipped_text=$(rage_flip_text "$input_text") + +echo "Original: $input_text" +echo "Flipped: $flipped_text" + +# Copy to clipboard based on available tools +if command -v pbcopy >/dev/null 2>&1; then + # macOS + echo -n "$flipped_text" | pbcopy + echo "✓ Copied to clipboard (macOS)" +elif command -v xclip >/dev/null 2>&1; then + # Linux with xclip + echo -n "$flipped_text" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" +elif command -v xsel >/dev/null 2>&1; then + # Linux with xsel + echo -n "$flipped_text" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" +elif command -v wl-copy >/dev/null 2>&1; then + # Wayland + echo -n "$flipped_text" | wl-copy + echo "✓ Copied to clipboard (Wayland)" +else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" +fi \ No newline at end of file diff --git a/unix/sarcasm.sh b/unix/sarcasm.sh new file mode 100755 index 0000000..679178b --- /dev/null +++ b/unix/sarcasm.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# sArCaSm text (alternating case) + +sarcasm_text() { + local input="$1" + local result="" + local char + local uppercase=true + + # Alternate case for each letter (not spaces or punctuation) + for (( i=0; i<${#input}; i++ )); do + char="${input:$i:1}" + + # Check if character is a letter + if [[ "$char" =~ [a-zA-Z] ]]; then + if $uppercase; then + result+="${char^^}" # Convert to uppercase + uppercase=false + else + result+="${char,,}" # Convert to lowercase + uppercase=true + fi + else + result+="$char" # Keep non-letters as-is + fi + done + + echo "$result" +} + +# Check if text is provided as argument +if [[ $# -eq 0 ]]; then + echo "Usage: $0 \"text to make sarcastic\"" + echo "Example: $0 \"This is so cool\"" + exit 1 +fi + +# Process the input text +input_text="$*" +sarcasm_result=$(sarcasm_text "$input_text") + +echo "Original: $input_text" +echo "sArCaSm: $sarcasm_result" + +# Copy to clipboard based on available tools +if command -v pbcopy >/dev/null 2>&1; then + # macOS + echo -n "$sarcasm_result" | pbcopy + echo "✓ Copied to clipboard (macOS)" +elif command -v xclip >/dev/null 2>&1; then + # Linux with xclip + echo -n "$sarcasm_result" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" +elif command -v xsel >/dev/null 2>&1; then + # Linux with xsel + echo -n "$sarcasm_result" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" +elif command -v wl-copy >/dev/null 2>&1; then + # Wayland + echo -n "$sarcasm_result" | wl-copy + echo "✓ Copied to clipboard (Wayland)" +else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" +fi \ No newline at end of file diff --git a/unix/strikethrough.sh b/unix/strikethrough.sh new file mode 100755 index 0000000..682b68f --- /dev/null +++ b/unix/strikethrough.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Strikethrough text using Unicode combining characters + +strikethrough_text() { + local input="$1" + local result="" + local char + + # Add combining strikethrough (U+0336) to each character + for (( i=0; i<${#input}; i++ )); do + char="${input:$i:1}" + if [[ "$char" != " " ]]; then + # Add combining strikethrough to non-space characters + result+="${char}̶" + else + result+="$char" + fi + done + + echo "$result" +} + +# Check if text is provided as argument +if [[ $# -eq 0 ]]; then + echo "Usage: $0 \"text to strikethrough\"" + echo "Example: $0 \"Hello World!\"" + exit 1 +fi + +# Process the input text +input_text="$*" +strikethrough_result=$(strikethrough_text "$input_text") + +echo "Original: $input_text" +echo "Strikethrough: $strikethrough_result" + +# Copy to clipboard based on available tools +if command -v pbcopy >/dev/null 2>&1; then + # macOS + echo -n "$strikethrough_result" | pbcopy + echo "✓ Copied to clipboard (macOS)" +elif command -v xclip >/dev/null 2>&1; then + # Linux with xclip + echo -n "$strikethrough_result" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" +elif command -v xsel >/dev/null 2>&1; then + # Linux with xsel + echo -n "$strikethrough_result" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" +elif command -v wl-copy >/dev/null 2>&1; then + # Wayland + echo -n "$strikethrough_result" | wl-copy + echo "✓ Copied to clipboard (Wayland)" +else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" +fi \ No newline at end of file diff --git a/unix/underline.sh b/unix/underline.sh new file mode 100755 index 0000000..c9489eb --- /dev/null +++ b/unix/underline.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Underline text using Unicode combining characters + +underline_text() { + local input="$1" + local result="" + local char + + # Add combining underline (U+0332) to each character + for (( i=0; i<${#input}; i++ )); do + char="${input:$i:1}" + if [[ "$char" != " " ]]; then + # Add combining underline to non-space characters + result+="${char}̲" + else + result+="$char" + fi + done + + echo "$result" +} + +# Check if text is provided as argument +if [[ $# -eq 0 ]]; then + echo "Usage: $0 \"text to underline\"" + echo "Example: $0 \"Hello World!\"" + exit 1 +fi + +# Process the input text +input_text="$*" +underlined_text=$(underline_text "$input_text") + +echo "Original: $input_text" +echo "Underlined: $underlined_text" + +# Copy to clipboard based on available tools +if command -v pbcopy >/dev/null 2>&1; then + # macOS + echo -n "$underlined_text" | pbcopy + echo "✓ Copied to clipboard (macOS)" +elif command -v xclip >/dev/null 2>&1; then + # Linux with xclip + echo -n "$underlined_text" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" +elif command -v xsel >/dev/null 2>&1; then + # Linux with xsel + echo -n "$underlined_text" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" +elif command -v wl-copy >/dev/null 2>&1; then + # Wayland + echo -n "$underlined_text" | wl-copy + echo "✓ Copied to clipboard (Wayland)" +else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" +fi \ No newline at end of file diff --git a/unix/word_flip.sh b/unix/word_flip.sh new file mode 100755 index 0000000..fe09075 --- /dev/null +++ b/unix/word_flip.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Unicode word flip (reverse word order) + +word_flip_text() { + local input="$1" + local words=() + local result="" + + # Split input into words and store in array + IFS=' ' read -ra words <<< "$input" + + # Reverse the order of words + for (( i=${#words[@]}-1; i>=0; i-- )); do + if [[ -n "$result" ]]; then + result+=" " + fi + result+="${words[$i]}" + done + + echo "$result" +} + +# Check if text is provided as argument +if [[ $# -eq 0 ]]; then + echo "Usage: $0 \"text to flip words\"" + echo "Example: $0 \"Hello World Everyone\"" + exit 1 +fi + +# Process the input text +input_text="$*" +flipped_text=$(word_flip_text "$input_text") + +echo "Original: $input_text" +echo "Flipped: $flipped_text" + +# Copy to clipboard based on available tools +if command -v pbcopy >/dev/null 2>&1; then + # macOS + echo -n "$flipped_text" | pbcopy + echo "✓ Copied to clipboard (macOS)" +elif command -v xclip >/dev/null 2>&1; then + # Linux with xclip + echo -n "$flipped_text" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" +elif command -v xsel >/dev/null 2>&1; then + # Linux with xsel + echo -n "$flipped_text" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" +elif command -v wl-copy >/dev/null 2>&1; then + # Wayland + echo -n "$flipped_text" | wl-copy + echo "✓ Copied to clipboard (Wayland)" +else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" +fi \ No newline at end of file diff --git a/windows/RageFlip.ps1 b/windows/RageFlip.ps1 new file mode 100644 index 0000000..4c1b089 --- /dev/null +++ b/windows/RageFlip.ps1 @@ -0,0 +1,65 @@ +# Rage flip (upside-down text) using Unicode +param( + [Parameter(Mandatory=$true, Position=0, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +# Unicode mapping for upside-down characters +$FlipMap = @{ + 'a' = 'ɐ'; 'b' = 'q'; 'c' = 'ɔ'; 'd' = 'p'; 'e' = 'ǝ'; 'f' = 'ɟ'; 'g' = 'ƃ'; 'h' = 'ɥ' + 'i' = 'ᴉ'; 'j' = 'ɾ'; 'k' = 'ʞ'; 'l' = 'l'; 'm' = 'ɯ'; 'n' = 'u'; 'o' = 'o'; 'p' = 'd' + 'q' = 'b'; 'r' = 'ɹ'; 's' = 's'; 't' = 'ʇ'; 'u' = 'n'; 'v' = 'ʌ'; 'w' = 'ʍ'; 'x' = 'x' + 'y' = 'ʎ'; 'z' = 'z' + 'A' = '∀'; 'B' = 'ᗺ'; 'C' = 'Ɔ'; 'D' = 'ᗡ'; 'E' = 'Ǝ'; 'F' = 'ᖴ'; 'G' = 'פ'; 'H' = 'H' + 'I' = 'I'; 'J' = 'ſ'; 'K' = 'ʞ'; 'L' = '˥'; 'M' = 'W'; 'N' = 'N'; 'O' = 'O'; 'P' = 'Ԁ' + 'Q' = 'Q'; 'R' = 'ᴿ'; 'S' = 'S'; 'T' = '┴'; 'U' = '∩'; 'V' = 'Λ'; 'W' = 'M'; 'X' = 'X' + 'Y' = '⅄'; 'Z' = 'Z' + '0' = '0'; '1' = 'Ɩ'; '2' = 'ᄅ'; '3' = 'Ɛ'; '4' = 'ㄣ'; '5' = 'ϛ'; '6' = '9'; '7' = 'ㄥ' + '8' = '8'; '9' = '6' + '!' = '¡'; '?' = '¿'; '.' = '˙'; ',' = "'"; ';' = '؛'; ':' = ':'; '(' = ')' + ')' = '('; '[' = '['; ']' = '['; '{' = '}' + ' ' = ' ' +} + +function RageFlipText { + param([string]$InputText) + + # Reverse the string and flip each character + $reversed = $InputText.ToCharArray() + [Array]::Reverse($reversed) + + $result = "" + foreach ($char in $reversed) { + $charStr = $char.ToString() + if ($FlipMap.ContainsKey($charStr)) { + $result += $FlipMap[$charStr] + } else { + $result += $charStr + } + } + + return $result +} + +# Join all arguments into a single string +$InputText = $Text -join " " + +if ([string]::IsNullOrWhiteSpace($InputText)) { + Write-Host "Usage: .\RageFlip.ps1 'text to flip'" + Write-Host "Example: .\RageFlip.ps1 'Hello World!'" + exit 1 +} + +# Process the input text +$FlippedText = RageFlipText -InputText $InputText + +Write-Host "Original: $InputText" +Write-Host "Flipped: $FlippedText" + +# Copy to clipboard +try { + Set-Clipboard -Value $FlippedText + Write-Host "✓ Copied to clipboard" +} catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" +} \ No newline at end of file diff --git a/windows/Sarcasm.ps1 b/windows/Sarcasm.ps1 new file mode 100644 index 0000000..7f5b06b --- /dev/null +++ b/windows/Sarcasm.ps1 @@ -0,0 +1,52 @@ +# sArCaSm text (alternating case) +param( + [Parameter(Mandatory=$true, Position=0, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +function SarcasmText { + param([string]$InputText) + + $result = "" + $uppercase = $true + + # Alternate case for each letter (not spaces or punctuation) + foreach ($char in $InputText.ToCharArray()) { + if ($char -match '[a-zA-Z]') { + if ($uppercase) { + $result += $char.ToString().ToUpper() + $uppercase = $false + } else { + $result += $char.ToString().ToLower() + $uppercase = $true + } + } else { + $result += $char # Keep non-letters as-is + } + } + + return $result +} + +# Join all arguments into a single string +$InputText = $Text -join " " + +if ([string]::IsNullOrWhiteSpace($InputText)) { + Write-Host "Usage: .\Sarcasm.ps1 'text to make sarcastic'" + Write-Host "Example: .\Sarcasm.ps1 'This is so cool'" + exit 1 +} + +# Process the input text +$SarcasmResult = SarcasmText -InputText $InputText + +Write-Host "Original: $InputText" +Write-Host "sArCaSm: $SarcasmResult" + +# Copy to clipboard +try { + Set-Clipboard -Value $SarcasmResult + Write-Host "✓ Copied to clipboard" +} catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" +} \ No newline at end of file diff --git a/windows/Strikethrough.ps1 b/windows/Strikethrough.ps1 new file mode 100644 index 0000000..ae3e22e --- /dev/null +++ b/windows/Strikethrough.ps1 @@ -0,0 +1,45 @@ +# Strikethrough text using Unicode combining characters +param( + [Parameter(Mandatory=$true, Position=0, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +function StrikethroughText { + param([string]$InputText) + + $result = "" + # Add combining strikethrough (U+0336) to each character + foreach ($char in $InputText.ToCharArray()) { + if ($char -ne ' ') { + # Add combining strikethrough to non-space characters + $result += $char.ToString() + [char]0x0336 + } else { + $result += $char + } + } + + return $result +} + +# Join all arguments into a single string +$InputText = $Text -join " " + +if ([string]::IsNullOrWhiteSpace($InputText)) { + Write-Host "Usage: .\Strikethrough.ps1 'text to strikethrough'" + Write-Host "Example: .\Strikethrough.ps1 'Hello World!'" + exit 1 +} + +# Process the input text +$StrikethroughResult = StrikethroughText -InputText $InputText + +Write-Host "Original: $InputText" +Write-Host "Strikethrough: $StrikethroughResult" + +# Copy to clipboard +try { + Set-Clipboard -Value $StrikethroughResult + Write-Host "✓ Copied to clipboard" +} catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" +} \ No newline at end of file diff --git a/windows/Underline.ps1 b/windows/Underline.ps1 new file mode 100644 index 0000000..640fcbd --- /dev/null +++ b/windows/Underline.ps1 @@ -0,0 +1,45 @@ +# Underline text using Unicode combining characters +param( + [Parameter(Mandatory=$true, Position=0, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +function UnderlineText { + param([string]$InputText) + + $result = "" + # Add combining underline (U+0332) to each character + foreach ($char in $InputText.ToCharArray()) { + if ($char -ne ' ') { + # Add combining underline to non-space characters + $result += $char.ToString() + [char]0x0332 + } else { + $result += $char + } + } + + return $result +} + +# Join all arguments into a single string +$InputText = $Text -join " " + +if ([string]::IsNullOrWhiteSpace($InputText)) { + Write-Host "Usage: .\Underline.ps1 'text to underline'" + Write-Host "Example: .\Underline.ps1 'Hello World!'" + exit 1 +} + +# Process the input text +$UnderlinedText = UnderlineText -InputText $InputText + +Write-Host "Original: $InputText" +Write-Host "Underlined: $UnderlinedText" + +# Copy to clipboard +try { + Set-Clipboard -Value $UnderlinedText + Write-Host "✓ Copied to clipboard" +} catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" +} \ No newline at end of file diff --git a/windows/WordFlip.ps1 b/windows/WordFlip.ps1 new file mode 100644 index 0000000..3286166 --- /dev/null +++ b/windows/WordFlip.ps1 @@ -0,0 +1,38 @@ +# Unicode word flip (reverse word order) +param( + [Parameter(Mandatory=$true, Position=0, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +function WordFlipText { + param([string]$InputText) + + # Split input into words and reverse the order + $words = $InputText -split '\s+' + [Array]::Reverse($words) + + return $words -join " " +} + +# Join all arguments into a single string +$InputText = $Text -join " " + +if ([string]::IsNullOrWhiteSpace($InputText)) { + Write-Host "Usage: .\WordFlip.ps1 'text to flip words'" + Write-Host "Example: .\WordFlip.ps1 'Hello World Everyone'" + exit 1 +} + +# Process the input text +$FlippedText = WordFlipText -InputText $InputText + +Write-Host "Original: $InputText" +Write-Host "Flipped: $FlippedText" + +# Copy to clipboard +try { + Set-Clipboard -Value $FlippedText + Write-Host "✓ Copied to clipboard" +} catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" +} \ No newline at end of file From f6e5d21c3af3f026870deb791ef3e799193664ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 27 Sep 2025 21:25:55 +0000 Subject: [PATCH 3/3] Add unified scripts and installation system Co-authored-by: stringsn88keys <252056+stringsn88keys@users.noreply.github.com> --- README.md | 53 ++++++++++- install.sh | 127 +++++++++++++++++++++++++ unix/text_flip.sh | 165 +++++++++++++++++++++++++++++++++ windows/TextFlip.ps1 | 215 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 555 insertions(+), 5 deletions(-) create mode 100755 install.sh create mode 100755 unix/text_flip.sh create mode 100644 windows/TextFlip.ps1 diff --git a/README.md b/README.md index 17ac626..f646f6e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,23 @@ All scripts automatically copy the transformed text to your system clipboard! ## Installation -### Linux/macOS (Unix-like systems) +### Quick Install (Linux/macOS) + +```bash +git clone https://github.com/stringsn88keys/script_flips.git +cd script_flips +./install.sh +``` + +The install script will: +- Make all scripts executable +- Check for clipboard utilities +- Test all scripts +- Provide setup instructions + +### Manual Installation + +#### Linux/macOS (Unix-like systems) 1. Clone the repository: ```bash @@ -56,6 +72,7 @@ sudo pacman -S xsel ### Linux/macOS Scripts +#### Individual Scripts ```bash # Rage flip (upside-down text) ./unix/rage_flip.sh "Hello World!" @@ -78,8 +95,20 @@ sudo pacman -S xsel # Output: H̶e̶l̶l̶o̶ W̶o̶r̶l̶d̶!̶ ``` +#### Unified Script (Recommended) +```bash +# Use the unified script for all transformations +./unix/text_flip.sh rage "Hello World!" +./unix/text_flip.sh sarcasm "This is so cool" + +# See all transformations at once +./unix/text_flip.sh all "Hello World!" +# Shows all effects and lets you choose which to copy +``` + ### Windows PowerShell Scripts +#### Individual Scripts ```powershell # Rage flip (upside-down text) .\windows\RageFlip.ps1 "Hello World!" @@ -102,6 +131,17 @@ sudo pacman -S xsel # Output: H̶e̶l̶l̶o̶ W̶o̶r̶l̶d̶!̶ ``` +#### Unified Script (Recommended) +```powershell +# Use the unified script for all transformations +.\windows\TextFlip.ps1 rage "Hello World!" +.\windows\TextFlip.ps1 sarcasm "This is so cool" + +# See all transformations at once +.\windows\TextFlip.ps1 all "Hello World!" +# Shows all effects and lets you choose which to copy +``` + ## Examples Transform "Hello World!" with different effects: @@ -119,18 +159,21 @@ Transform "Hello World!" with different effects: ``` script_flips/ -├── unix/ # Linux/macOS bash scripts +├── unix/ # Linux/macOS bash scripts │ ├── rage_flip.sh │ ├── word_flip.sh │ ├── underline.sh │ ├── sarcasm.sh -│ └── strikethrough.sh -├── windows/ # Windows PowerShell scripts +│ ├── strikethrough.sh +│ └── text_flip.sh # 🌟 Unified script (recommended) +├── windows/ # Windows PowerShell scripts │ ├── RageFlip.ps1 │ ├── WordFlip.ps1 │ ├── Underline.ps1 │ ├── Sarcasm.ps1 -│ └── Strikethrough.ps1 +│ ├── Strikethrough.ps1 +│ └── TextFlip.ps1 # 🌟 Unified script (recommended) +├── install.sh # Installation script for Unix └── README.md ``` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..c1d2b02 --- /dev/null +++ b/install.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# Installation script for text_flips scripts + +set -e + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +print_step() { + echo -e "${BLUE}➤${NC} $1" +} + +print_success() { + echo -e "${GREEN}✓${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}⚠${NC} $1" +} + +print_error() { + echo -e "${RED}✗${NC} $1" +} + +echo "🎨 script_flips Installation" +echo "=============================" +echo "" + +# Check if we're in the right directory +if [[ ! -f "unix/rage_flip.sh" ]]; then + print_error "Installation script must be run from the script_flips directory" + exit 1 +fi + +print_step "Making scripts executable..." +chmod +x unix/*.sh +print_success "Scripts are now executable" + +# Check for clipboard tools +print_step "Checking for clipboard utilities..." + +clipboard_found=false + +if command -v pbcopy >/dev/null 2>&1; then + print_success "Found pbcopy (macOS clipboard support)" + clipboard_found=true +fi + +if command -v xclip >/dev/null 2>&1; then + print_success "Found xclip (Linux clipboard support)" + clipboard_found=true +fi + +if command -v xsel >/dev/null 2>&1; then + print_success "Found xsel (Linux clipboard support)" + clipboard_found=true +fi + +if command -v wl-copy >/dev/null 2>&1; then + print_success "Found wl-copy (Wayland clipboard support)" + clipboard_found=true +fi + +if ! $clipboard_found; then + print_warning "No clipboard utility found" + echo "" + echo "To enable clipboard functionality on Linux, install one of:" + echo " • xclip: sudo apt install xclip (Ubuntu/Debian) or sudo dnf install xclip (Fedora)" + echo " • xsel: sudo apt install xsel (Ubuntu/Debian) or sudo dnf install xsel (Fedora)" + echo " • wl-clipboard: sudo apt install wl-clipboard (Ubuntu/Debian) - for Wayland" + echo "" +fi + +# Test scripts +print_step "Testing scripts..." + +test_text="Hello World!" +failed_tests=0 + +for script in unix/*.sh; do + script_name=$(basename "$script") + if [[ "$script_name" == "text_flip.sh" ]]; then + continue # Skip the unified script for now + fi + + if ./"$script" "$test_text" >/dev/null 2>&1; then + print_success "$(basename "$script") - OK" + else + print_error "$(basename "$script") - FAILED" + ((failed_tests++)) + fi +done + +# Test unified script +if ./unix/text_flip.sh rage "$test_text" >/dev/null 2>&1; then + print_success "text_flip.sh (unified) - OK" +else + print_error "text_flip.sh (unified) - FAILED" + ((failed_tests++)) +fi + +echo "" + +if [[ $failed_tests -eq 0 ]]; then + print_success "All tests passed! Installation complete." + echo "" + echo "🎯 Quick Start:" + echo " ./unix/text_flip.sh rage \"Hello World!\"" + echo " ./unix/text_flip.sh all \"Your text here\"" + echo "" + echo "📖 See README.md for detailed usage instructions" +else + print_error "$failed_tests script(s) failed testing" + exit 1 +fi + +# Optional: Add to PATH suggestion +echo "" +echo "💡 Optional: Add to your PATH for global access" +echo " Add this line to your ~/.bashrc or ~/.zshrc:" +echo " export PATH=\"\$PATH:$(pwd)/unix\"" +echo "" +echo " Then you can use: text_flip.sh rage \"Hello World!\" from anywhere" \ No newline at end of file diff --git a/unix/text_flip.sh b/unix/text_flip.sh new file mode 100755 index 0000000..f04cedc --- /dev/null +++ b/unix/text_flip.sh @@ -0,0 +1,165 @@ +#!/bin/bash +# Unified text transformation script - all transformations in one + +print_usage() { + echo "Usage: $0 \"text to transform\"" + echo "" + echo "Available transformations:" + echo " rage - Upside-down text (ɹɐƃǝ ɟlᴉd)" + echo " word - Reverse word order" + echo " underline - Add underlines (u̲n̲d̲e̲r̲l̲i̲n̲e̲)" + echo " sarcasm - Alternating case (sArCaStIc)" + echo " strike - Strikethrough text (s̶t̶r̶i̶k̶e̶)" + echo " all - Show all transformations" + echo "" + echo "Examples:" + echo " $0 rage \"Hello World!\"" + echo " $0 sarcasm \"This is so cool\"" + echo " $0 all \"Hello World!\"" +} + +# Check if arguments are provided +if [[ $# -lt 2 ]]; then + print_usage + exit 1 +fi + +transformation="$1" +shift +input_text="$*" + +# Get the directory where this script is located +script_dir="$(dirname "${BASH_SOURCE[0]}")" + +copy_to_clipboard() { + local text="$1" + + if command -v pbcopy >/dev/null 2>&1; then + echo -n "$text" | pbcopy + echo "✓ Copied to clipboard (macOS)" + elif command -v xclip >/dev/null 2>&1; then + echo -n "$text" | xclip -selection clipboard + echo "✓ Copied to clipboard (Linux - xclip)" + elif command -v xsel >/dev/null 2>&1; then + echo -n "$text" | xsel --clipboard --input + echo "✓ Copied to clipboard (Linux - xsel)" + elif command -v wl-copy >/dev/null 2>&1; then + echo -n "$text" | wl-copy + echo "✓ Copied to clipboard (Wayland)" + else + echo "⚠ Clipboard tool not found. Install xclip, xsel, or wl-clipboard for Linux, or use on macOS" + fi +} + +run_transformation() { + local transform="$1" + local text="$2" + local result="" + local script_path="" + + case "$transform" in + "rage") + script_path="$script_dir/rage_flip.sh" + ;; + "word") + script_path="$script_dir/word_flip.sh" + ;; + "underline") + script_path="$script_dir/underline.sh" + ;; + "sarcasm") + script_path="$script_dir/sarcasm.sh" + ;; + "strike") + script_path="$script_dir/strikethrough.sh" + ;; + *) + echo "Error: Unknown transformation '$transform'" + return 1 + ;; + esac + + if [[ -x "$script_path" ]]; then + "$script_path" "$text" 2>/dev/null | grep -E "^(Original:|Flipped:|Underlined:|sArCaSm:|Strikethrough:)" || echo "Error running $script_path" + else + echo "Error: Script $script_path not found or not executable" + fi +} + +case "$transformation" in + "rage"|"word"|"underline"|"sarcasm"|"strike") + # Run the individual script directly + case "$transformation" in + "rage") + "$script_dir/rage_flip.sh" "$input_text" + ;; + "word") + "$script_dir/word_flip.sh" "$input_text" + ;; + "underline") + "$script_dir/underline.sh" "$input_text" + ;; + "sarcasm") + "$script_dir/sarcasm.sh" "$input_text" + ;; + "strike") + "$script_dir/strikethrough.sh" "$input_text" + ;; + esac + ;; + "all") + echo "Input: $input_text" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "" + + echo "🔄 Rage Flip:" + rage_result=$("$script_dir/rage_flip.sh" "$input_text" 2>/dev/null | grep "Flipped:" | sed 's/Flipped: //') + echo " $rage_result" + echo "" + + echo "🔄 Word Flip:" + word_result=$("$script_dir/word_flip.sh" "$input_text" 2>/dev/null | grep "Flipped:" | sed 's/Flipped: //') + echo " $word_result" + echo "" + + echo "🔄 Underline:" + underline_result=$("$script_dir/underline.sh" "$input_text" 2>/dev/null | grep "Underlined:" | sed 's/Underlined: //') + echo " $underline_result" + echo "" + + echo "🔄 sArCaSm:" + sarcasm_result=$("$script_dir/sarcasm.sh" "$input_text" 2>/dev/null | grep "sArCaSm:" | sed 's/sArCaSm: //') + echo " $sarcasm_result" + echo "" + + echo "🔄 Strikethrough:" + strike_result=$("$script_dir/strikethrough.sh" "$input_text" 2>/dev/null | grep "Strikethrough:" | sed 's/Strikethrough: //') + echo " $strike_result" + echo "" + + echo "Select which result to copy to clipboard:" + echo "1) Rage Flip: $rage_result" + echo "2) Word Flip: $word_result" + echo "3) Underline: $underline_result" + echo "4) sArCaSm: $sarcasm_result" + echo "5) Strikethrough: $strike_result" + echo "0) None" + + read -p "Enter choice (0-5): " choice + + case "$choice" in + 1) copy_to_clipboard "$rage_result" ;; + 2) copy_to_clipboard "$word_result" ;; + 3) copy_to_clipboard "$underline_result" ;; + 4) copy_to_clipboard "$sarcasm_result" ;; + 5) copy_to_clipboard "$strike_result" ;; + 0) echo "No text copied." ;; + *) echo "Invalid choice. No text copied." ;; + esac + ;; + *) + echo "Error: Unknown transformation '$transformation'" + print_usage + exit 1 + ;; +esac \ No newline at end of file diff --git a/windows/TextFlip.ps1 b/windows/TextFlip.ps1 new file mode 100644 index 0000000..d772da8 --- /dev/null +++ b/windows/TextFlip.ps1 @@ -0,0 +1,215 @@ +# Unified text transformation script for PowerShell - all transformations in one +param( + [Parameter(Mandatory=$false, Position=0)] + [string]$Transformation, + + [Parameter(Mandatory=$false, Position=1, ValueFromRemainingArguments=$true)] + [string[]]$Text +) + +function Show-Usage { + Write-Host "Usage: .\TextFlip.ps1 'text to transform'" + Write-Host "" + Write-Host "Available transformations:" + Write-Host " rage - Upside-down text (ɹɐƃǝ ɟlᴉd)" + Write-Host " word - Reverse word order" + Write-Host " underline - Add underlines (u̲n̲d̲e̲r̲l̲i̲n̲e̲)" + Write-Host " sarcasm - Alternating case (sArCaStIc)" + Write-Host " strike - Strikethrough text (s̶t̶r̶i̶k̶e̶)" + Write-Host " all - Show all transformations" + Write-Host "" + Write-Host "Examples:" + Write-Host " .\TextFlip.ps1 rage 'Hello World!'" + Write-Host " .\TextFlip.ps1 sarcasm 'This is so cool'" + Write-Host " .\TextFlip.ps1 all 'Hello World!'" +} + +# Unicode mapping for rage flip +$FlipMap = @{ + 'a' = 'ɐ'; 'b' = 'q'; 'c' = 'ɔ'; 'd' = 'p'; 'e' = 'ǝ'; 'f' = 'ɟ'; 'g' = 'ƃ'; 'h' = 'ɥ' + 'i' = 'ᴉ'; 'j' = 'ɾ'; 'k' = 'ʞ'; 'l' = 'l'; 'm' = 'ɯ'; 'n' = 'u'; 'o' = 'o'; 'p' = 'd' + 'q' = 'b'; 'r' = 'ɹ'; 's' = 's'; 't' = 'ʇ'; 'u' = 'n'; 'v' = 'ʌ'; 'w' = 'ʍ'; 'x' = 'x' + 'y' = 'ʎ'; 'z' = 'z' + 'A' = '∀'; 'B' = 'ᗺ'; 'C' = 'Ɔ'; 'D' = 'ᗡ'; 'E' = 'Ǝ'; 'F' = 'ᖴ'; 'G' = 'פ'; 'H' = 'H' + 'I' = 'I'; 'J' = 'ſ'; 'K' = 'ʞ'; 'L' = '˥'; 'M' = 'W'; 'N' = 'N'; 'O' = 'O'; 'P' = 'Ԁ' + 'Q' = 'Q'; 'R' = 'ᴿ'; 'S' = 'S'; 'T' = '┴'; 'U' = '∩'; 'V' = 'Λ'; 'W' = 'M'; 'X' = 'X' + 'Y' = '⅄'; 'Z' = 'Z' + '0' = '0'; '1' = 'Ɩ'; '2' = 'ᄅ'; '3' = 'Ɛ'; '4' = 'ㄣ'; '5' = 'ϛ'; '6' = '9'; '7' = 'ㄥ' + '8' = '8'; '9' = '6' + '!' = '¡'; '?' = '¿'; '.' = '˙'; ',' = "'"; ';' = '؛'; ':' = ':'; '(' = ')' + ')' = '('; '[' = '['; ']' = '['; '{' = '}' + ' ' = ' ' +} + +function Invoke-RageFlip($InputText) { + $reversed = $InputText.ToCharArray() + [Array]::Reverse($reversed) + + $result = "" + foreach ($char in $reversed) { + $charStr = $char.ToString() + if ($FlipMap.ContainsKey($charStr)) { + $result += $FlipMap[$charStr] + } else { + $result += $charStr + } + } + return $result +} + +function Invoke-WordFlip($InputText) { + $words = $InputText -split '\s+' + [Array]::Reverse($words) + return $words -join " " +} + +function Invoke-Underline($InputText) { + $result = "" + foreach ($char in $InputText.ToCharArray()) { + if ($char -ne ' ') { + $result += $char.ToString() + [char]0x0332 + } else { + $result += $char + } + } + return $result +} + +function Invoke-Sarcasm($InputText) { + $result = "" + $uppercase = $true + + foreach ($char in $InputText.ToCharArray()) { + if ($char -match '[a-zA-Z]') { + if ($uppercase) { + $result += $char.ToString().ToUpper() + $uppercase = $false + } else { + $result += $char.ToString().ToLower() + $uppercase = $true + } + } else { + $result += $char + } + } + return $result +} + +function Invoke-Strikethrough($InputText) { + $result = "" + foreach ($char in $InputText.ToCharArray()) { + if ($char -ne ' ') { + $result += $char.ToString() + [char]0x0336 + } else { + $result += $char + } + } + return $result +} + +function Copy-ToClipboardSafe($text) { + try { + Set-Clipboard -Value $text + Write-Host "✓ Copied to clipboard" + } catch { + Write-Host "⚠ Failed to copy to clipboard: $($_.Exception.Message)" + } +} + +# Check if parameters are provided +if ([string]::IsNullOrWhiteSpace($Transformation) -or ($Text.Count -eq 0 -and $Transformation -ne "help")) { + Show-Usage + exit 1 +} + +# Join all text arguments into a single string +$InputText = $Text -join " " + +switch ($Transformation.ToLower()) { + "rage" { + $result = Invoke-RageFlip -InputText $InputText + Write-Host "Original: $InputText" + Write-Host "Flipped: $result" + Copy-ToClipboardSafe $result + } + "word" { + $result = Invoke-WordFlip -InputText $InputText + Write-Host "Original: $InputText" + Write-Host "Flipped: $result" + Copy-ToClipboardSafe $result + } + "underline" { + $result = Invoke-Underline -InputText $InputText + Write-Host "Original: $InputText" + Write-Host "Underlined: $result" + Copy-ToClipboardSafe $result + } + "sarcasm" { + $result = Invoke-Sarcasm -InputText $InputText + Write-Host "Original: $InputText" + Write-Host "sArCaSm: $result" + Copy-ToClipboardSafe $result + } + "strike" { + $result = Invoke-Strikethrough -InputText $InputText + Write-Host "Original: $InputText" + Write-Host "Strikethrough: $result" + Copy-ToClipboardSafe $result + } + "all" { + Write-Host "Input: $InputText" + Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + Write-Host "" + + $rageResult = Invoke-RageFlip -InputText $InputText + $wordResult = Invoke-WordFlip -InputText $InputText + $underlineResult = Invoke-Underline -InputText $InputText + $sarcasmResult = Invoke-Sarcasm -InputText $InputText + $strikeResult = Invoke-Strikethrough -InputText $InputText + + Write-Host "🔄 Rage Flip:" + Write-Host " $rageResult" + Write-Host "" + + Write-Host "🔄 Word Flip:" + Write-Host " $wordResult" + Write-Host "" + + Write-Host "🔄 Underline:" + Write-Host " $underlineResult" + Write-Host "" + + Write-Host "🔄 sArCaSm:" + Write-Host " $sarcasmResult" + Write-Host "" + + Write-Host "🔄 Strikethrough:" + Write-Host " $strikeResult" + Write-Host "" + + Write-Host "Select which result to copy to clipboard:" + Write-Host "1) Rage Flip: $rageResult" + Write-Host "2) Word Flip: $wordResult" + Write-Host "3) Underline: $underlineResult" + Write-Host "4) sArCaSm: $sarcasmResult" + Write-Host "5) Strikethrough: $strikeResult" + Write-Host "0) None" + + $choice = Read-Host "Enter choice (0-5)" + + switch ($choice) { + "1" { Copy-ToClipboardSafe $rageResult } + "2" { Copy-ToClipboardSafe $wordResult } + "3" { Copy-ToClipboardSafe $underlineResult } + "4" { Copy-ToClipboardSafe $sarcasmResult } + "5" { Copy-ToClipboardSafe $strikeResult } + "0" { Write-Host "No text copied." } + default { Write-Host "Invalid choice. No text copied." } + } + } + default { + Write-Host "Error: Unknown transformation '$Transformation'" + Show-Usage + exit 1 + } +} \ No newline at end of file