Skip to content

Instantly share code, notes, and snippets.

View chrodriguez's full-sized avatar

Christian Rodriguez chrodriguez

View GitHub Profile
@chrodriguez
chrodriguez / Makefile
Last active May 25, 2021 12:24
Agregar una marca de agua (o firma) a un PDF con varias páginas y a su vez paginarlas
FILES=certificaciones.pdf autor.pdf distinciones.pdf expositor.pdf titulos.pdf
CONVERT_FLAGS=-auto-orient -quality 100 -density 200
all.pdf: $(FILES)
pdfunite $(FILES) all-pre.pdf
./cpdf -scale-to-fit a4portrait -o all.pdf all.pdf
rm all-pre.pdf
certificaciones.pdf:
convert Certificaciones/* $(CONVERT_FLAGS) certificaciones.pdf
@chrodriguez
chrodriguez / matrix_file_handler.c
Created June 16, 2020 14:01
Ejemplo de como leer la matriz de tipo M1, planteando el ejemplo de la librería completa del TPI de Seminario de Lenguaje C 2020
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#define MAX_LENGTH 4096
typedef void (* t_matrix_file_handler_by_type)(FILE *);
@chrodriguez
chrodriguez / kind-metrics-server.yaml
Last active February 18, 2020 15:45 — forked from hjacobs/kind-metrics-server.yaml
Metrics Server API deployment manifests for Kubernetes kind
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:aggregated-metrics-reader
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
- apiGroups: ["metrics.k8s.io"]
@chrodriguez
chrodriguez / bootways-bootstrap
Last active January 3, 2020 18:18
Bootways bootstrap installer
#!/bin/bash
usage() {
echo $0 DIRECTORY
exit 1
}
[ "$#" -ne 1 ] && usage
echo Installing bootways...
@chrodriguez
chrodriguez / crear-mosaicos.sh
Last active August 27, 2019 22:43
Como crear un mosaico de imagenes en un PDF
DPI=300
# Como las dimensiones del A3 son 16.5x11.7 pulgadas, para poder hacer esto en shell:
X=165
Y=117
ANCHO=$(( $X*$DPI/10 ))
AlTO=$(( $Y*$DPI/10 ))
COUNT=0
FILES=""
DONE=0
SPACES=50
@chrodriguez
chrodriguez / vsphere-vms-without-autostart.sh
Created July 30, 2018 15:54
vmware vsphere set autostart script
#!/bin/bash
set -eo pipefail
usage() {
if [ ! -z "$1" ]; then
echo -e "ERROR:\n" 1>&2
echo -e "\t$@"
echo
fi
@chrodriguez
chrodriguez / dockerhub-readme-update.sh
Last active November 10, 2022 21:39
How to update dockerhub readme automatically
#!/bin/bash
usage() {
if [ ! -z $1 ]; then
echo -e "ERROR:\n" 1>&2
fi
echo "Usage: $0 -f /path/to/README.md -u dockerhub-username [-r dockerhub-repo-prefix] -n repo-name" 1>&2
exit 1;
}
while getopts ":r:u:f:n:" o; do
@chrodriguez
chrodriguez / php-cli.sh
Last active March 16, 2022 23:11
PHP wrappers docker based
#!/bin/bash
set -e
[ -z "$PHP_CLI_DOCKER_IMAGE" ] && ( echo You must set PHP_CLI_DOCKER_IMAGE environment variable ; exit 1)
PHP_OPTIONS=${PHP_OPTIONS:- -d 'date.timezone=America/Argentina/Buenos_Aires' -d memory_limit=512M}
PHP_CLI_DOCKER_RUN_OPTIONS=${PHP_CLI_DOCKER_RUN_OPTIONS:-'--add-host local.docker:172.17.0.1'}
docker run --rm -it -u `id -u $USER`:`id -g $USER` -v "`pwd`:`pwd`" -w "`pwd`" $PHP_CLI_DOCKER_RUN_OPTIONS $PHP_CLI_DOCKER_IMAGE $PHP_OPTIONS $@
@chrodriguez
chrodriguez / remove-finished-torrents
Last active January 6, 2024 22:48
Transmission delete finished torrents
#!/bin/sh
TORRENTLIST=`transmission-remote --auth=user:pass --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
for TORRENTID in $TORRENTLIST
do
echo "* * * * * Operations on torrent ID $TORRENTID starting. * * * * *"
DL_COMPLETED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "Percent Done: 100%"`
STATE_STOPPED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "State: Stopped\|Finished\|Idle"`
if [ "$DL_COMPLETED" != "" ] && [ "$STATE_STOPPED" != "" ]; then