scripts

#!/bin/sh

Bash

Download de todas imagens em kopimi.com

codetitle. kopimi.bash

#!/bin/bash
## Kopimi 2015 - this file has no license to begin with
## This script downloads all images available on kopimi.com as of 2015-12-14.
## It will take up 456 kilobytes of storage space.
## If you don't have bash and wget, and an internet connection, this will not work.

SITE="http://kopimi.com/kopimi/"
FILES=( "kobi_ibi" "c_mini_5" "c_mini_6" "c_mini_1" "c_mini_2" "c_mini_3" "c_mini_4" "c_mini_7" "c_coin" "cccp" "c_fi" "c_time_kopimi" "linku" "c_limkmi_kopimi" "kopitalism" "AK" "monika" "c_dollar_copyme" "cpyramid_kopimi4" "cpyramid_kopimi3" "cyellow_girl" "cpyramid_kopimi2" "c_pyramid_kopimi" "c_pyramid" "c" "linku" "copyme1_wh_bg" "copyme1_wh_bg" "copymeyy" "copyme1_black_bg" "copyme2_blck_bg" "copyme_fajaf" "copyme_bbg" )
FILES_K=( "kopimi_grey" "mkopimi_grey" "kopimi_text" "mkopimi_text" "mkopimi_irssi" "kopimi_follow_yellow_fellow" "mkopimi_gay""kopimi_gay" "mkopimi_nietzche_zarathustr" "kopimi_kurdistan_tyskland" "kopimi_nietzche_zarathustra" "m_kopimi_follow_yellow_fell" "kopimi_irssi" "kopimi_dialektik" "kopimi_amerika_america_us_u" )
FILES_IMAGES=( "c_mini_01" "c_mini_02" "c_mini_03" "c_mini_04" "c_mini_05" "c_mini_06" "c_mini_07" "c_mini_08" "c_mini_09" "c_mini_10" "c_mini_11" "c_mini_12" "c_mini_13" "c_mini_14" "c_mini_15" "c_mini_16" "c_mini_17" "c_mini_18" "c_mini_19" "c_mini_20" "c_mini_21" "c_mini_22" "c_mini_23" "c_mini_24" "c_mini_25" "c_mini_26" "c_mini_27" "c_mini_28" "c_mini_29" "c_mini_30" "c_mini_31" "c_mini_32" "c_mini_33" "c_mini_34" "c_mini_35" )

for FILE in ${FILES[@]}
do
	wget "${SITE}/${FILE}.gif"
	sleep 1
done

for FILE in ${FILES_K[@]}
do
	wget "${SITE}/k/${FILE}.gif"
	sleep 1
done

for FILE in ${FILES_IMAGES[@]}
do
	wget "${SITE}/images/${FILE}.gif"
	sleep 1
done

Script para converter imagens para o formato de stickers do telegram

codetitle. telegram-stickers.bash

#!/bin/bash
## Kopimi 2015 - this file has no license to begin with
## Source code should be at:
## https://notabug.org/desci/scripts/src/master/telegram-stickers.bash
##
## This script converts the given image to a png format accepted by telegram's
## stickers bot (https://telegram.me/stickers).
## You need ImageMagick for this to work.
##
## To convert all images in a directory, you could try something like this:
## for IMAGE in *.gif *.jpg; do bash telegram-stickers.bash ${IMAGE}; done
##

if [ ! -z $1 ]
then
	## This test whether the first argument is an image.
	if [ "`file -ib $1 | grep -e '^image/'`" != "" ]
	then
		IMAGE="${1}"
		NEW_IMAGE="`basename ${IMAGE} | sed -s 's/\.[A-Za-z]*$/\.png/'`"
		WIDTH=`identify -format %w "${IMAGE}"`
		HEIGHT=`identify -format %h "${IMAGE}"`
		## We need to know whether we have to reduce the width or the height.
		if [ ${WIDTH} -gt ${HEIGHT} ]
		then
			convert -resize 512 "${IMAGE}" "${NEW_IMAGE}"
			echo "${IMAGE} converted to 512 width, automagically adjusted height. Saved to ${NEW_IMAGE}"
		elif [ ${WIDTH} -lt ${HEIGHT} ]
		then
			convert -resize x512 "${IMAGE}" "${NEW_IMAGE}"
			echo "${IMAGE} converted to 512 height, automagically adjusted width. Saved to ${NEW_IMAGE}"
		elif [ ${WIDTH} -eq ${HEIGHT} ]
		then
			convert -resize 512x512 "${IMAGE}" "${NEW_IMAGE}"
			echo "${IMAGE} converted to 512 width and 512 height. Saved to ${NEW_IMAGE}"
		else
			echo "I'm not sure what to do with ${IMAGE}."
		fi
	else
		echo "${1}: Not an image. Or so I decided."
	fi
else
	echo -e "Example of usage: ${0} image.png"
fi

Repositório git