Skip to content

Instantly share code, notes, and snippets.

View junquera's full-sized avatar
🐈‍⬛

Javier JUNQUERA SÁNCHEZ junquera

🐈‍⬛
View GitHub Profile
@junquera
junquera / imagesToPDF.sh
Created November 20, 2015 22:36
Convert all the folder image files to PDF
#!/usr/bin/env bash
for i in *; do convert "$i" "${i%.*}".pdf; done;
@junquera
junquera / carga_masiva.py
Created November 20, 2015 22:38
Script en python para generar los datos de inserción masiva de la PECL2 de Bases de Datos Avanzadas (Asignatura de 3º en la Universidad de Alcalá)
#! /usr/bin/env python
# CARGA MASIVA POSTGRESQL
# # -*- coding: UTF-8
# 100 Planes de precios con cuotas entre 20 y 100 euros
# 500.000 clientes dados de alta
# Cada cliente, tiene una línea dada de alta
# Hay almacenados 12 millones de consumos de voz y de mensajes, repartidos entre todas las líneas y realizadas a lo largo de los meses del año 2014
# Cada lnea tiene una factura de acuerdo a su consumo y su plan de precios que tiene asociado para cada mes del año 2014
import random
#!/bin/bash
imgsDir="$1";
file="$2";
extra=0;
for i in "$imgsDir"*; do
position=${i##*/};
position="${position%.*}";
if [ $position == 1 ]; then
pdftk "$i" "$file" output tmp.pdf;
else
@junquera
junquera / stopLoading.html
Created December 3, 2015 18:27
Command for adding html code before binary files and only show a web message.
<html>
<head>
<meta charset="unicode">
</head>
<body>
<script>
document.write("YOUR MESSAGE HERE");
window.stop();
</script>
</body>
@junquera
junquera / instalado.sh
Created December 3, 2015 19:13
Alert when an instalation ends
#!/bin/sh
#export BEEP=/usr/share/sounds/gnome/default/alerts/drip.ogg;
#alias beep='paplay $BEEP';
paplay /usr/share/sounds/gnome/default/alerts/drip.ogg;
notify-send "Installation completed" "Look at the terminal" -i /home/junquera/Imágenes/Iconos/usi.png;
@junquera
junquera / backup.sh
Created December 3, 2015 23:12
Backup all the system
#!/bin/bash
sudo tar czf /backup.tar.gz -u --exclude=/backup.tar.gz --exclude=/home --exclude=/media --exclude=/dev --exclude=/mnt --exclude=/proc --exclude=/tmp /;
@junquera
junquera / script1.sh
Created February 15, 2016 22:14
List and show all files and folders in a directory
for i in $(find .);
do
if [ -d $i ];
then
echo "Dir $i"
else
echo "File $i" && cat "$i"
fi
done
@junquera
junquera / getAllImages.js
Created February 18, 2016 10:29
Get all images from a web page
$('body').append($('img').map(function(){
return $(this).attr('src')
}).get())
@junquera
junquera / README.md
Last active February 26, 2016 10:27
Crear archivo $2 de tamaño $1

Ejemplo

Crear archivo de 10MB llamado prueba

$:- creaFile.sh 10MB prueba
@junquera
junquera / printDiv.js
Last active April 12, 2016 10:59
Print web element
function padToThree(number) {
if (number<=9999) { number = ("00"+number).slice(-3); }
return number;
}
function printDiv(divId) {
var printContents = $(divId).html();
var originalContents = document.body.innerHTML;
document.body.innerHTML = "<html><head><title></title></head><body>" + printContents + "</body>";
window.print();
document.body.innerHTML = originalContents;