This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def array_chunk(arr, size): | |
chunks=[arr[x:x+size] for x in xrange(0, len(arr), size)] | |
return chunks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for FILE in *gz | |
do | |
gunzip ${FILE} | |
UNFILE=${FILE%.*} | |
xz -3vv ${UNFILE} | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from OpenSSL import crypto | |
import os | |
import sys | |
import datetime | |
import whois | |
#Variables | |
TYPE_RSA = crypto.TYPE_RSA | |
TYPE_DSA = crypto.TYPE_DSA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UUID | |
from sqlalchemy.dialects.mysql import BINARY | |
from sqlalchemy.types import TypeDecorator | |
class BinaryUUID(TypeDecorator): | |
'''Optimize UUID keys. Store as 16 bit binary, retrieve as uuid. | |
inspired by: | |
http://mysqlserverteam.com/storing-uuid-values-in-mysql-tables/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
KUBEAPI=127.0.0.1:8001/api/v1/nodes | |
function getNodes() { | |
curl -s $KUBEAPI | jq -r '.items[].metadata.name' | |
} | |
function getPVCs() { | |
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\ |
OlderNewer