Skip to content

Instantly share code, notes, and snippets.

View QuanticPotatoes's full-sized avatar

Jérémy Dieuze QuanticPotatoes

View GitHub Profile
@QuanticPotatoes
QuanticPotatoes / extract-images-from-pdf.ts
Created February 21, 2022 15:25
extract images from pdf with pdf-lib, Jimp and file-type
import { PDFDocument, PDFRawStream } from 'pdf-lib';
import * as FileType from 'file-type';
import Jimp from 'jimp';
const extractImageFromPDF = async (file: Buffer) => {
const pdfDoc = await PDFDocument.load(file, { ignoreEncryption: true });
const indirects = pdfDoc.context.enumerateIndirectObjects();
const images = [];
for (let i = 0; i < indirects.length; i += 1) {
const [, pdfObject] = indirects[i];
@QuanticPotatoes
QuanticPotatoes / europe-language.json
Last active December 10, 2018 19:37
Language spoken on Europe with iso639_1
[
{
"name": "Swedish",
"nativeName": "svenska",
"iso": "sv"
},
{
"name": "Albanian",
"nativeName": "Shqip",
"iso": "sq"
@QuanticPotatoes
QuanticPotatoes / Makefile
Created July 31, 2018 11:49
Makefile template
.PHONY: build test help
.DEFAULT_GOAL := help
NODE_ENV ?= development
help:
@grep -P '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# If the first argument is one of the supported commands...
@QuanticPotatoes
QuanticPotatoes / tmux.conf
Last active March 12, 2024 08:43
Configuration tmux with powerline
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- navigation ----------------------------------------------------------------
# if you're running tmux within iTerm2
# - and tmux is 1.9 or 1.9a