Skip to content

Instantly share code, notes, and snippets.

View alambike's full-sized avatar

Javier Gómez Rodríguez alambike

View GitHub Profile
@alambike
alambike / index.php
Created July 17, 2018 12:52
test vm scale set
<?php
echo "<h1 style='text-align: center'>".gethostname()."</h1><hr>";
phpinfo();
@alambike
alambike / docker_size.sh
Last active February 5, 2019 12:13
docker, size of all running container write layer
#!/bin/bash
for d in $(docker ps -q);
do
container_layer=$(docker inspect --format '{{ .GraphDriver.Data.MergedDir }}' $d);
size=$(du -sh $container_layer/..|cut -f1);
echo "container $d escribe en $container_layer, ocupa $size";
done
#================
Start Swarm setup
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ROLE=MANAGER
PRIVATE_IP=10.0.0.6
DOCKER_FOR_IAAS_VERSION=azure-v1.13.0-rc4-beta14
ACCOUNT_ID=0aff12f8-9fd1-467b-b90a-5979b2aabf60
REGION=northeurope
AZURE_HOSTNAME=e4b4e1ca87f5
#================
@alambike
alambike / get_pid_env.pl
Created February 15, 2016 08:41
Obtener environment de un proceso
use strict;
use Data::Dumper;
my $pid = $ARGV[0];
open my $f, "/proc/$pid/environ" || die($!);
my $linea = <$f>;
print Dumper(split '\0', $linea);
@alambike
alambike / run install-font-ubuntu.sh
Created September 21, 2015 23:45
Install Monaco font in ubuntu
curl -kL https://raw.github.com/cstrap/monaco-font/master/install-font-ubuntu.sh | sudo bash
@alambike
alambike / Ensuring a Clean Device Removal
Last active August 29, 2015 14:22
Remove a block device
Ensuring a Clean Device Removal
* Close all users of the device and backup device data as needed.
* Use umount to unmount any file systems that mounted the device.
* Remove the device from any md and LVM volume using it. If the device is a member of an LVM Volume group, then it may be necessary to move data off the device using the pvmove command, then use the vgreduce command to remove the physical volume, and (optionally) pvremove to remove the LVM metadata from the disk.
* If the device uses multipathing, run multipath -l and note all the paths to the device. Afterwards, remove the multipathed device using multipath -f device.
* Run blockdev –flushbufs device to flush any outstanding I/O to all paths to the device. This is particularly important for raw devices, where there is no umount or vgreduce operation to cause an I/O flush.
* Remove any reference to the device's path-based name, like /dev/sd, /dev/disk/by-path or the major:minor number, in applications, scripts, or utilities on the system. This is
@alambike
alambike / repair-grub2.txt
Created June 3, 2015 03:11
Commands to repair grub2 from a live cd
sudo mount /dev/sdXY /mnt
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sdXY
grub-install --recheck /dev/sdXY
@alambike
alambike / .tmux.conf
Last active August 29, 2015 14:21
configuracion do byobu con tmux para poder usar a roda do mouse para facer scroll, e Ctrl-Left ,Right para moverse entre palabras
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-window-option -g xterm-keys on
@alambike
alambike / mongodb
Last active August 29, 2015 14:16
NOTAS
# Reparar as tablas de mongodb, por exemplo cando se cerrou mal o servidor, para correxir o erro:
# exception in initAndListen: 12596 old lock file, terminating
mongodb mongod --repair --dbpath /var/lib/mongodb/
chown -R mongodb:mongodb /var/lib/mongodb
@alambike
alambike / sysctl.conf
Created December 8, 2014 12:02
ubuntu sysctl.conf tune up from rtcamp.com (https://rtcamp.com/tutorials/linux/sysctl-conf/)
### IMPROVE SYSTEM MEMORY MANAGEMENT ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2