Skip to content

Instantly share code, notes, and snippets.

View knee-cola's full-sized avatar

knee-cola

View GitHub Profile
@knee-cola
knee-cola / pdfsplit.sh
Created October 10, 2024 07:10
Splits a given a multi-page PDF document info multiple single-page files
#!/bin/bash
# pdfsplit.sh [input-file.pdf]
#
# Example: pdfsplit.sh input.pdf
#
# written by: ChatGPT under supervision of knee-cola
# Check if input PDF file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <input-pdf-file>"
#!/bin/sh
#
# Extracts a range of pages from the given multi-page PDF document into a new PDF documents
#
# pdfsplit [input.pdf] [first_page] [last_page] [output.pdf]
#
# Example: pdfsplit big_file.pdf 10 20 pages_ten_to_twenty.pdf
#
# written by: Westley Weimer, Wed Mar 19 17:58:09 EDT 2008
#
#!/bin/sh
# Merges multiple PDF files into a single PDF file
#
# pdfmerge.sh [input-1.pdf] [input-2.pdf] [output.pdf]
#
# Example: pdfmerge.sh input-1.pdf input-2.pdf output.pdf
#
# written by: Knee-cola
#
# The trick: ghostscript (gs) will do PDF merging for you, it's just not
#!/bin/bash
# Converst pages of the given PDF document into a serie of PNG files (ie: output-1.png, output-2.png, ...)
if [ "$1" == "" ] ; then
printf "\nMissing input file."
printf "\n\nSyntax:\n\n pdf2png.sh input.pdf\n\n"
exit 1
fi
#!/bin/bash
# Converts a given input file into a PDF document
# Check if the input argument is provided
if [ -z "$1" ]; then
echo "Usage: $0 <input_file.jpeg>"
exit 1
fi
#!/bin/bash
# Converts a SBV (YouTube) Subtitles to CSV format,
# so that they can be imported to Spreadsheet for editing
# Check if input file is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 input_file.sbv"
exit 1
fi
#define DEBUG
#ifdef DEBUG
// https://forum.arduino.cc/index.php?topic=46900.0
#define DEBUG_PRINT(str) Serial.println(str);
#define DEBUG_PRINT2(str1, str2) Serial.print(str1); Serial.println(str2);
#else
#define DEBUG_PRINT(str)
#define DEBUG_PRINT2(str1, str2)
#endif
@knee-cola
knee-cola / define-process-shim.js
Created December 5, 2018 09:32
Shim for `process` variable for CDN modules packed as UMD
if(!this.process) {
this.process = {};
}
if(!this.process.env) {
this.process.env = {};
}
if(!this.process.env.NODE_ENV) {
this.process.env.NODE_ENV = "production";
@knee-cola
knee-cola / _README.md
Last active January 23, 2023 14:43
tracking battery usage on Windows laptop

What's this?

This is a script, which tracks charging and discharging time of a Windows powered laptop.

It creates a log file, which contains information about time the laptop spend charging and discharging the battery. The collected information can give you a pretty good idea about the battery life of your laptop.

Here's a sample:

charge=77