This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SET PATH=%PATH%;C:\Program Files\gs\gs9.27\bin | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
REM 0. create tmpdir to put all the temporary files | |
RMDIR /S /Q tmp_pdf_folder | |
DEL first_pages.pdf | |
mkdir tmp_pdf_folder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go through all files in the folder | |
files <- list.files(path=".", pattern="*.tab", full.names=TRUE, recursive=FALSE) | |
# read all of them into a list of data.frames | |
# Note: "lapply" is much faster than a for-loop, but I am not sure how it sorts | |
table_list <- lapply(files, function(x) { | |
x <- read.table(x, sep="\t", header=F) | |
colnames(x) <- c("count", "x", "y") | |
x | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL EnableDelayedExpansion | |
FOR %%a IN (%*) DO ( | |
SET filename=%%a | |
REM https://gist.github.com/ALoecken/c01eff8bbc181599b6530fcb0cb8266a | |
CALL %0\..\compress_pdf.bat -h "%%a" "!filename:~0,-4!_compr.pdf" | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
:: The location of your Ghostscript installation... | |
SET PATH=%PATH%;C:\Program Files\gs\gs9.26\bin | |
IF ""%1""=="""" GOTO HELP | |
SET FN=%1 | |
SET FN=%FN:"=% | |
ECHO Counting the number of colored pages in "%FN%". | |
:: count number of colored pages: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
::SET PATH=%PATH%;C:\Program Files\gs\gs9.26\bin | |
SET gs=gs | |
:: Searching for ghostscript | |
WHERE %gs% >nul 2>nul | |
IF %ERRORLEVEL% NEQ 0 SET gs=gswin | |
WHERE %gs% >nul 2>nul | |
IF %ERRORLEVEL% NEQ 0 SET gs=gswin64 |