Skip to content

Instantly share code, notes, and snippets.

fxpires

Block or report user

Report or block fxpires

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fxpires
fxpires / jboss-log-compression.sh
Created Oct 26, 2018
JBoss/Wildfly Log compression. Compress both server.log and access_log (if exists). Ignores already compressed logs in gz or xz formats
View jboss-log-compression.sh
# Server log compression
find /opt/jboss/standalone/log -maxdepth 1 -type f -name 'server.log.*' -not -name '*xz' -not -name '*gz' -exec xz -3 {} \;
# default-host log compression
test -d /opt/jboss/standalone/log/default-host && find /opt/jboss/standalone/log/default-host -type f -mtime +0 -not -name '*xz' -exec xz -3 {} \;
@fxpires
fxpires / recompress.sh
Created Oct 26, 2018
recompress all gzip in current dir files as xz files, keeping the timestamps / recomprime arquivos no diretório atual, de gz para xz, mantendo os timestamps
View recompress.sh
#!/bin/bash
for FILE in *gz
do
gunzip ${FILE}
UNFILE=${FILE%.*}
xz -3vv ${UNFILE}
done
View image_append.py
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 Jun 8, 2018 — forked from amitittyerah/array_chunk.py
array_chunk($arr, $size) version of Python
View array_chunk.py
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 Feb 21, 2018
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
View unsplash-random.sh
#!/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 Feb 21, 2018
Recompress all gzip files in current directory as xz / Recomprime os arquivos gzip em um diretório como xz
View gz2xz.sh
#!/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 Nov 4, 2015 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
View QRLogo.php
<?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;
You can’t perform that action at this time.