Skip to content

Instantly share code, notes, and snippets.

View Matheus-Ribeiro95's full-sized avatar

Matheus Ribeiro Matheus-Ribeiro95

  • Brazil
View GitHub Profile
@rfl890
rfl890 / btoa-atob-utf8.js
Created May 29, 2023 15:58
btoa and atob with UTF-8 support
function btoaUTF8(data) {
const utf8Data = new TextEncoder().encode(data);
let binaryString = "";
for (let i = 0; i < utf8Data.length; i++) {
binaryString += String.fromCharCode(utf8Data[i]);
}
return btoa(binaryString);
}
function atobUTF8(data) {
const decodedData = atob(data);
@rbpatt2019
rbpatt2019 / save_as_pdf.py
Created March 30, 2020 15:10
Save multiple images to one pdf using Pillow
from glob import glob
import os.path as path
from PIL import Image
def convert(img):
'''Convert an RGBA image to an RGB image
If the passed image has:
img.mode == 'RGBA'
then it will be converted to RGB.