Skip to content

Instantly share code, notes, and snippets.

View mdibello's full-sized avatar

Matthew DiBello mdibello

View GitHub Profile
// Estimating CPU frequency...
// CPU frequency: 4.52 GHz
// sum1: value = 15182118497126522709, 0.31 secs, 5.14 cycles/elem
// sum2: value = 15182118497126522709, 0.17 secs, 2.93 cycles/elem
#define RW(x) asm("" : "+r"(x))
typedef struct Node {
u64 value;
struct Node *next;
@josue
josue / pdf-conversion-fun.md
Last active September 3, 2025 05:50
Using ImageMagick to easily: Split, Merge, Remove a page from PDF.

Install Required libraries:

sudo apt-get update && sudo apt-get install imagemagick gs

create directory to test commands

mkdir -p pdf_conversion/{merged,split}
cd pdf_conversion
@bbotelho3
bbotelho3 / Convert a PDF file to black and white (not grayscale)
Last active March 11, 2021 12:37
Convert a PDF file to black and white (not grayscale)
# The first approach that I found was to convert using a virtual device using Ghostscript.
# The virtual device, pdfwrite, supports parameters to convert the original PDF file to another PDF file in grayscale.
# In my case, I wanted only black and white, so this was not enough.
#!/bin/bash
gs \
-sOutputFile=output.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \