Skip to content

Instantly share code, notes, and snippets.

View enxebre's full-sized avatar

Alberto García Lamela enxebre

View GitHub Profile
@enxebre
enxebre / mesos-cluster.sh
Last active February 16, 2016 10:49
Easy and quick debugging a Mesos/Marathon/Consul Cluster. Load the file by ". mesos-cluster.sh". Use it
#!/bin/bash
# Just because I'm tired of copy/paste from evernote.
export MARATHON_URL=${MARATHON_URL:-'127.0.0.1:8080'}
export CONSUL_URL=${CONSUL_URL:-'127.0.0.1:8500'}
export MESOS_URL=${MESOS_URL:-'127.0.0.1:5050'}
function mesosHealth() {
curl -v -x '' "${MESOS_URL}"/master/health
@enxebre
enxebre / gdb_redirect_ouput.sh
Last active August 29, 2015 14:13
gdb_redirect_ouput
# From /dev/null to file
gdb -p processpid
(gdb) call creat("/home/me/myprog.stdout",0600)
$1 = 7
(gdb) call dup2(7,1)
$2 = 1
(gdb) call creat("/home/me/myprog.stderr",0600)
$3 = 8
(gdb) call dup2(8,2)
# Removing all containers
docker rm `docker ps --no-trunc -aq`
# Mac restart all network interfaces
for i in `ifconfig -l `; do sudo ifconfig $i down && sudo ifconfig $i up; done
#Routing table.
netstat -rn
route -n
ip route list
#Checking ports.
netstat –lp --inet
# Users list.
cat /etc/passwd
# Groups list.
cat /etc/group
# List of groups for a given user.
id -nG vagrant
# Creating a new user.
# 1. To free pagecache, dentries and inodes in cache memory
sync; echo 3 > /proc/sys/vm/drop_caches
# 2. To free dentries and inodes use following command
sync; echo 2 > /proc/sys/vm/drop_caches
# 3. To free pagecache only use following command
sync; echo 1 > /proc/sys/vm/drop_caches
swapoff
@enxebre
enxebre / git pull-request-rebase.sh
Last active August 29, 2015 14:02
Git commands for update your pull request branch with the last master changes
git remote add upstream git://github.com/your-repo
git checkout master
git fetch upstream
git merge upstream/master
git checkout BRANCH_NAME
git rebase master
@enxebre
enxebre / resizing_partitions.sh
Last active August 29, 2015 13:58
Resizing partitions
#!/bin/bash
fdisk -l
df -h
du -sh ./*
mkfs.ext3
pvscan
pvdisplay
@enxebre
enxebre / Jenkins_xml_sync_script.sh
Last active August 29, 2015 13:57
Bash script for syncronize xml jenkins files with a given repo.
#!/bin/bash
_help() {
cat <<EOHELP
USAGE: $0 <command> <folder> <repo> <branch>[...]
Run actions for keeping a git repo up to date with the last changes in a given Jenkins folder.
COMMANDS:
sync syncronize the jenkins file with a given repo.