Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
etchelepi authored Sep 8, 2017
1 parent 561fe3e commit c2ab027
Show file tree
Hide file tree
Showing 7 changed files with 321 additions and 0 deletions.
32 changes: 32 additions & 0 deletions BatchSubsitute.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo off

REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION

if /I "%~1"=="/h" goto:help
if "%3"=="" goto:help

if "%~1"=="" findstr "^::" "%~f0"&goto:help
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
set "line=%%B"
if defined line (
call set "line=echo.%%line:%~1=%~2%%"
for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X >> %3_new
) ELSE echo.
)
move /Y %3_new %3 >nul

goto:eof

:help
echo BatchSubstitude - parses a File line by line and replaces a substring
echo.
echo Usage: %0 [oldstr] [newstr] [filename]
echo. oldstr - string to be replaced
echo. newstr - string to replace with
echo. filname - file to be parsed
echo.
goto:eof

:eof
34 changes: 34 additions & 0 deletions full_generate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@echo off


setlocal ENABLEDELAYEDEXPANSION
set /a total_quotes = 0;

REM This generates the TRUMP tweets
set /a c =-1
for /F "tokens=*" %%A in (resource/trumpisims.txt) do (
set /a c = c + 2
copy /Y resource\trump.svg resource\temp.svg
CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg
)
set /a trump_total_quotes = !c!/2

REM This generates the HILLARY Tweets
set /a c =0
for /F "tokens=*" %%A in (resource/clintonsays.txt) do (
set /a c = c + 2
copy /Y resource\clinton.svg resource\temp.svg
CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg
)
set /a clinton_total_quotes = !c!/2

set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes

echo "END GENERATE TWEETS"


for /L %%i in (0,1,%total_quotes%) do (
CALL makeboard.bat
)
2 changes: 2 additions & 0 deletions get_dirs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo off
for /d %%a in (*) do dir /ad /on /s /b "%%a" >> get_dirs.txt
2 changes: 2 additions & 0 deletions get_files.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo off
for /r %%a in (*) do echo %%a >> get_files.txt
96 changes: 96 additions & 0 deletions loopPrint.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
@echo off


setlocal ENABLEDELAYEDEXPANSION
set /a total_quotes = 0;
REM This generates the TRUMP tweets
set /a c =-1
for /F "tokens=*" %%A in (resource/trumpisims.txt) do (
set /a c = c + 2
copy /Y resource\trump.svg resource\temp.svg
CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg
)
set /a trump_total_quotes = !c!/2


REM This generates the HILLARY Tweets
set /a c =0
for /F "tokens=*" %%A in (resource/clintonsays.txt) do (
set /a c = c + 2
copy /Y resource\clinton.svg resource\temp.svg
CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg
)
set /a clinton_total_quotes = !c!/2

echo "END GENERATE TWEETS"

set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes

REM echo %trump_total_quotes%
REM echo %clinton_total_quotes%
REM echo %total_quotes%

setlocal enabledelayedexpansion enableextensions
set i=-1
FOR /L %%G IN (1,1,%total_quotes%) DO (

set /a i=!i!+1
set suffled_list[!i!]=%%G
)
set lastindex=!i!

REM for /L %%G in (0,1,!lastindex!) do (
REM echo !suffled_list[%%G]!
REM )
echo THIS IS THE DEBUG LOCATION
set /A tot = %total_quotes% - 1
echo the total is %tot%
set lis=


for /L %%i in (0,1,%tot%) do (
set /A ran=!RANDOM! * %tot% / 32768 + 1
set /A j=!ran!
REM SAVE THE ORGINAL VALUE
set /A TEM= !suffled_list[%%i]!
REM SAVE THE VALUE AT THE RANDOM LOCATION
for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]!
REM set i to be the J value
set /A suffled_list[%%i] = !TEMJ!
REM set j to be the value of i
for %%j in (!j!) do set suffled_list[%%j]=!TEM!
)
echo PRINT LIST
REM for /L %%G in (0,1,!lastindex!) do (
REM echo !suffled_list[%%G]!
REM )
REM WE GENERATE THE BOARD FROM THE FIRST 24

REM We need to loop through the 25 first elements.
REM For each value returned we check if it's even or odd
REM if even we put the hilary pretext, odd we put the trump
REM we then append the number to the end so we have something like %HIL_or_trump%_tweets\%hilary_or_trump%_tweet_%number%.png
REM then this massive string is put into IMAGE MAGIC. Special case is for element 24 we just use a fixed tweet

for /L %%G in (0,1,24) do (
set /A temp_var=!suffled_list[%%G]! %%2
set other_var=!suffled_list[%%G]!
IF %%G == 12 (
set lis= !lis!resource\free.png
) ELSE (
IF !temp_var! == 0 (
set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png

) ELSE (
set lis= !lis!trump_tweets\trump_tweet_!other_var!.png
)
)
)


echo ONCE
call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg
echo other
call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg
68 changes: 68 additions & 0 deletions makeboard.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@echo off

setlocal ENABLEDELAYEDEXPANSION
set /a total_quotes = 0;
REM This generates the TRUMP tweets
set /a c =-1
for /F "tokens=*" %%A in (resource/trumpisims.txt) do (
set /a c = c + 2
)
set /a trump_total_quotes = !c!/2

REM This generates the HILLARY Tweets
set /a c =0
for /F "tokens=*" %%A in (resource/clintonsays.txt) do (
set /a c = c + 2
)
set /a clinton_total_quotes = !c!/2

set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes

REM echo %trump_total_quotes%
REM echo %clinton_total_quotes%
REM echo %total_quotes%

setlocal enabledelayedexpansion enableextensions
set i=-1
FOR /L %%G IN (1,1,%total_quotes%) DO (

set /a i=!i!+1
set suffled_list[!i!]=%%G
)
set lastindex=!i!

REM for /L %%G in (0,1,!lastindex!) do (
REM echo !suffled_list[%%G]!
REM )
set /A tot = %total_quotes% - 1
set lis=

for /L %%i in (0,1,%tot%) do (
set /A ran=!RANDOM! * %tot% / 32768 + 1
set /A j=!ran!
REM SAVE THE ORGINAL VALUE
set /A TEM= !suffled_list[%%i]!
REM SAVE THE VALUE AT THE RANDOM LOCATION
for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]!
REM set i to be the J value
set /A suffled_list[%%i] = !TEMJ!
REM set j to be the value of i
for %%j in (!j!) do set suffled_list[%%j]=!TEM!
)

for /L %%G in (0,1,24) do (
set /A temp_var=!suffled_list[%%G]! %%2
set other_var=!suffled_list[%%G]!
IF %%G == 12 (
set lis= !lis!resource\free.png
) ELSE (
IF !temp_var! == 0 (
set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png

) ELSE (
set lis= !lis!trump_tweets\trump_tweet_!other_var!.png
)
)
)
call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg
call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg
87 changes: 87 additions & 0 deletions makeboard_org.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@echo off


setlocal ENABLEDELAYEDEXPANSION
set /a total_quotes = 0;
REM This generates the TRUMP tweets
set /a c =-1
for /F "tokens=*" %%A in (resource/trumpisims.txt) do (
set /a c = c + 2
REM copy /Y resource\trump.svg resource\temp.svg
REM CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
REM inkscape --export-png=trump_tweets/trump_tweet_!c!.png resource/temp.svg
)
set /a trump_total_quotes = !c!/2


REM This generates the HILLARY Tweets
set /a c =0
for /F "tokens=*" %%A in (resource/clintonsays.txt) do (
set /a c = c + 2
REM copy /Y resource\clinton.svg resource\temp.svg
REM CALL BatchSubsitute.bat REPLACE "%%A" resource\temp.svg
REM inkscape --export-png=clinton_tweets/clinton_tweet_!c!.png resource/temp.svg
)
set /a clinton_total_quotes = !c!/2

set /a total_quotes = 0 + %clinton_total_quotes% + %trump_total_quotes

REM echo %trump_total_quotes%
REM echo %clinton_total_quotes%
REM echo %total_quotes%

setlocal enabledelayedexpansion enableextensions
set i=-1
FOR /L %%G IN (1,1,%total_quotes%) DO (

set /a i=!i!+1
set suffled_list[!i!]=%%G
)
set lastindex=!i!

REM for /L %%G in (0,1,!lastindex!) do (
REM echo !suffled_list[%%G]!
REM )
set /A tot = %total_quotes% - 1
set lis=


for /L %%i in (0,1,%tot%) do (
set /A ran=!RANDOM! * %tot% / 32768 + 1
set /A j=!ran!
REM SAVE THE ORGINAL VALUE
set /A TEM= !suffled_list[%%i]!
REM SAVE THE VALUE AT THE RANDOM LOCATION
for %%j in (!j!) do set /A TEMJ = !suffled_list[%%j]!
REM set i to be the J value
set /A suffled_list[%%i] = !TEMJ!
REM set j to be the value of i
for %%j in (!j!) do set suffled_list[%%j]=!TEM!
)
REM for /L %%G in (0,1,!lastindex!) do (
REM echo !suffled_list[%%G]!
REM )
REM WE GENERATE THE BOARD FROM THE FIRST 24

REM We need to loop through the 25 first elements.
REM For each value returned we check if it's even or odd
REM if even we put the hilary pretext, odd we put the trump
REM we then append the number to the end so we have something like %HIL_or_trump%_tweets\%hilary_or_trump%_tweet_%number%.png
REM then this massive string is put into IMAGE MAGIC. Special case is for element 24 we just use a fixed tweet

for /L %%G in (0,1,24) do (
set /A temp_var=!suffled_list[%%G]! %%2
set other_var=!suffled_list[%%G]!
IF %%G == 12 (
set lis= !lis!resource\free.png
) ELSE (
IF !temp_var! == 0 (
set lis= !lis!clinton_tweets\clinton_tweet_!other_var!.png

) ELSE (
set lis= !lis!trump_tweets\trump_tweet_!other_var!.png
)
)
)
call magick montage !lis! -mode Concatenate -tile 5x5 montage_array.jpg
call magick montage resource\banner.png montage_array.jpg resource\footer.png -mode Concatenate -tile x3 montage_array_Result_%RANDOM%.jpg

0 comments on commit c2ab027

Please sign in to comment.