Skip to content

Instantly share code, notes, and snippets.

@4lberto
4lberto / html5tovideo_with_phantomjs
Created June 18, 2018 22:28
gets an html5 canvas and writes one image per frame. First version
var page = require('webpage').create();
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
console.log("Antes de llamara a la carga")
page.onCallback = function(data){
console.log("llamda a onCallBack a través de window número "+data)
success=page.render("example_"+data+".png")
@4lberto
4lberto / gist:82da4ae9b194ce8ca1c9fae6c534d9e1
Last active September 19, 2019 02:05
Docker: stop & remove all containers
#List all containers (only IDs)
docker ps -aq
#Stop all running containers.
docker stop $(docker ps -aq)
#Remove all containers.
docker rm $(docker ps -aq)
#Remove all images.
@4lberto
4lberto / gist:d90b7b1a4a0b90c62961e1ba77bc7a86
Created May 29, 2018 10:08
Clone and upload all remote branches of a repo
git clone https://git.myrepo.com/group/reponame.git
cd reponame
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
cd ..
@4lberto
4lberto / gist:08c6fd1ec535a54f28267696ff86c3a0
Created April 12, 2018 06:38
Run shell command in background
https://superuser.com/questions/178587/how-do-i-detach-a-process-from-terminal-entirely
"You can background it by first stopping it (hit Ctrl-Z) and then typing bg to let it resume in the background. It's now a "job", and its stdout/stderr/stdin are still connected to your terminal."
You can start a process as backgrounded immediately by appending a "&" to the end of it: firefox &
@4lberto
4lberto / Nexus 3 on Ubuntu
Created April 11, 2018 15:36
Launch a container with Nexus 3 in Ubuntu. Uses a host directory to crate a volume to store data
#!/bin/bash
#Create a directory to store the data in
mkdir nexus-data
chown -R 200:200 nexus-data
#Launch docker with a volume
docker run -d -p 28081:28081 --name nexus -v $(pwd)nexus-data:/sonatype-work sonatype/nexus3
#show log
docker logs -f nexus3
#Comprobar qué unidades hay conectadas
sudo blkid
#Crear el punto de montaje
sudo mkdir /mnt/vol1
#Realizar montaje de unidad
sudo mount /dev/sdd2 /mnt/vol1/
#Install vbox tools
sudo apt-get install virtualbox-guest-additions-iso
#Resize volume (increase). In MB and tellin the vdi location
VBoxManage modifyhd “C:\Users\Chris\VirtualBox VMs\Windows 7\Windows 7.vdi” --resize 81920
#Checking the size
echo $HISTFILESIZE $HISTSIZE
#Chaning the size
HISTFILESIZE=10000000
HISTSIZE=10000000
#Later execute
echo $HISTFILESIZE $HISTSIZE
@4lberto
4lberto / hosts
Last active January 13, 2018 21:29
127.0.0.1 localhost
127.0.1.1 XPS-8700
127.0.0.1 forocoches.com
127.0.0.1 www.forocoches.com
127.0.0.1 marca.com
127.0.0.1 marca.es
127.0.0.1 www.elmundo.es
127.0.0.1 elmundo.es
127.0.0.1 meneame.net
127.0.0.1 facebook.com
@4lberto
4lberto / gist:0ed59f069482a0aa20fc0385d8ae728a
Created August 23, 2017 14:39
Copy al war files to tmp dir
cp $(find . |grep '\.war$' |grep target) /tmp/war