I was trying some TDD with [Tesk-Kitchen][1] and [ServerSpec][2] when I found myself in the following case scenario:
I have a integration test like this:
# cookbook_webtest/test/integration/default/serverspec/localhost/webtest_spec.rb
# cookbook/files/default/pushover_handler.rb | |
require "net/https" | |
module MyOrg | |
class PushOver < Chef::Handler | |
def initialize(config={}) | |
@config = config | |
end |
cookbook 'apt' | |
cookbook 'monit' | |
cookbook 'logstash', git: 'git://github.com/lusis/chef-logstash.git' |
@ECHO ON | |
REM This batch script is almost identical to http://code.can.cd/winrm_setup.bat | |
REM To use this from powershell on windows in a one liner: | |
REM (New-Object System.Net.WebClient).DownloadFile('https://gist.github.com/juanje/8496054/raw/winrm_setup.bat','winrm_setup.bat') ; .\winrm_setup.bat | |
cmd.exe /c winrm quickconfig -q | |
cmd.exe /c winrm quickconfig -transport:http | |
cmd.exe /c winrm set winrm/config @{MaxTimeoutms="1800000"} | |
cmd.exe /c winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"} | |
cmd.exe /c winrm set winrm/config/service @{AllowUnencrypted="true"} |
I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.
As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin
and add the following group to the file /etc/cgconfig.conf
:
group browsers {
cpu {
# Set the relative share of CPU resources equal to 25%
cpu.shares = "256";
}
<!doctype html> | |
<html> | |
<head> | |
<title>Testing cartodb.js with Chart.js with some random data</title> | |
<script src="http://www.chartjs.org/assets/Chart.js"></script> | |
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no"> | |
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script> | |
<style> | |
canvas{ | |
} |
<!doctype html> | |
<html> | |
<head> | |
<title>Playas con bandera azul en España, por regiones</title> | |
<script src="http://www.chartjs.org/assets/Chart.js"></script> | |
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no"> | |
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script> | |
<style> | |
canvas{ | |
} |
<html> | |
<head> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" /> | |
<!--[if lte IE 8]> | |
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.ie.css" /> | |
<![endif]--> | |
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script> | |
<style> | |
html, body {width:100%; height:100%; padding: 0; margin: 0;} | |
#map { width: 100%; height:90%; background: black;} |
import requests | |
def test_website_1(host): | |
"""Check if the website is recheable from outside the managed host, | |
using the standar Python's library Requests. | |
It also check for the website content. | |
""" | |
host_ip = host.interface("eth0").addresses[0] | |
result = requests.get(f'http://{host_ip}') |
# The command to see the space used under each directory is `du -sh /*` | |
# The `2> /dev/null` at the end is to avoid get lost with a lot of minor errors. | |
# For the example 'mydockerimage' is the name of the Docker image to be checked. | |
# Another way is to use Dive (https://github.com/wagoodman/dive), a really nice tool for this. | |
docker run --rm -u root --entrypoint "" mydockerimage du -sh /* 2> /dev/null |