Skip to content

Instantly share code, notes, and snippets.

from PIL import Image
# Partially inspired by https://stackoverflow.com/a/30228308/2237660
# images: list() of PIL.Image.Image
# stack: False=> append horizontally (side-by-side), True=> append vertically (stacking bottom-to-up)
# bgcolor: final image background color. Default: white
def append_images(images, stack=False, bgcolor='white'):
# sanity checks
if not isinstance(images, list):
return False
@fxpires
fxpires / array_chunk.py
Last active June 8, 2018 19:48 — forked from amitittyerah/array_chunk.py
array_chunk($arr, $size) version of Python
def array_chunk(arr, size):
chunks=[arr[x:x+size] for x in xrange(0, len(arr), size)]
return chunks
@fxpires
fxpires / unsplash-random.sh
Created February 21, 2018 16:55
Change the lockscreen of Gnome with a random image from unsplash.com / Defne a imagem da tela de bloqueio do Gnome com uma imagem aleatória do site unsplash.com
#!/bin/bash
#IMG_DIR=${HOME}/.unsplash
IMG_DIR=/home/fabiano/.unsplash
URL="http://source.unsplash.com/random"
DATE_TIME=$(LANG=C date +%F_%T | sed 's/:/./g')
IMG=${IMG_DIR}/${DATE_TIME}.jpg
if [ ! -d ${IMG_DIR} ]; then
mkdir ${IMG_DIR}
@fxpires
fxpires / gz2xz.sh
Created February 21, 2018 16:43
Recompress all gzip files in current directory as xz / Recomprime os arquivos gzip em um diretório como xz
#!/bin/bash
GZ_LIST="*gz"
for GZ_FILE in ${GZ_LIST}
do
echo "Processing file ${GZ_FILE}"
FILENAME="${GZ_FILE%.*}"
gunzip -c ${GZ_FILE} | xz -3vv -c > ${FILENAME}.xz
RES=$?
touch -r ${GZ_FILE} ${FILENAME}.xz
if [ $? -eq 0 ]; then
@fxpires
fxpires / QRLogo.php
Created November 4, 2015 15:42 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;