This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat << EOF | |
usage: $0 options | |
This script sets ownership for all tables, sequences, views, and functions for a given schema. | |
Run this script as your postgres OS user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To create a classic TCP listening daemon, similar to netcat -l, use a variation of the following command. | |
socat TCP-LISTEN:8080 stdout | |
# use remotly a command shell | |
socat TCP4-LISTEN:1234,reuseaddr,fork 'SYSTEM:/bin/cat /home/infos.txt' | |
# SSLfy a server | |
socat OPENSSL-LISTEN:443,reuse‐addr,pf=ip4,fork,cert=server.pem,cafile=client.crt TCP4-CONNECT:localhost:80 | |
# remote logger on server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Preparar una imagen con la ISO de la distribución a generar (driver tap:aio:) | |
# Preparar un DATABLOCK de un tamaño de 5-8Gb (driver tap:aio:, formato ext3 (pe) y de tipo persistente) | |
# Preparar un template que boote de la imagen del CDROM y que tenga como storage adicional el DATABLOCK | |
# Instalación... >> El resultado será una imagen raw multiparticionada MBR, /boot y LVM en formato RAW | |
# Convertir la imagen a formato qcow2 | |
qemu-img convert -f raw my_image.img -O qcow2 my_image.qcow2 | |
# Montar la nueva imagen: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mount the img (qcow2) | |
guestmount -a my_vm.qcow2 -i /mnt/my_vm —rw | |
# Hacemos chroot | |
chroot /mnt/my_vm | |
# Clean yum information | |
/usr/bin/yum —enablerepo=extra,repos,if,apply clean all | |
# Rotate logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def translate(settings) | |
settings.inject({}) do |hash, (key, value)| | |
case key | |
when 'foo' then hash[:foo] = value | |
when 'bar' then hash[:bar] = value.split(%r,/) | |
end | |
hash | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourClass | |
DEFAUL_PARAMETER_VALUE = :foo | |
def your_method(parameter, options={ }) | |
options = { :default_parameter =>DEFAULT_PARAMETER_VALUE }.merge(options) | |
# Do something with this | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module YourModule | |
VALID_OPTIONS = [ :foo, :bar ] | |
def your_method(parameter, options={ }) | |
invalid_options = options.keys - VALID_OPTIONS | |
raise ArgumentError, "invalid option(s): #{invalid_options.join(', ')}" if invalid_options.any? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RABBITMQ_VHOST="/chef" | |
RABBITMQ_USERNAME="chef" | |
RABBITMQ_PASSWORD="testing" | |
CHEF_COUCH_URL="http://127.0.0.1:5984/chef" | |
console() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim:ft=sh | |
function generate_project() { | |
[ -d "${1}" ] && { | |
echo "The directory: ${1} already exist" | |
exit 1 | |
} | |
local project="${1}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original Source: https://github.com/chneukirchen/styleguide | |
= Christian Neukirchen's Ruby Style Guide | |
You may not like all rules presented here, but they work very well for | |
me and have helped producing high quality code. Everyone is free to | |
code however they want, write and follow their own style guides, but | |
when you contribute to my code, please follow these rules: | |