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
import boto | |
from boto.ec2.autoscale import ScalingPolicy | |
from boto.ec2.cloudwatch import MetricAlarm | |
autoscale = boto.connect_autoscale() | |
cloudwatch = boto.connect_cloudwatch() | |
# Let's assume you already have an Auto Scaling group. | |
# Setting one up is well documented elsewhere. |
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
aptitude safe-upgrade --simulate --assume-yes | awk -F ' ' '/[0-9]+ packages upgraded/ {print $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
# Counter | |
echo -n 'some.metric.namespace:1|c' | nc -u -q0 localhost 8125 | |
# Gauge | |
echo -n 'some.metric.namespace:100|g' | nc -u -q0 localhost 8125 | |
# Timer | |
echo -n 'some.metric.namespace:342|ms' | nc -u -q0 localhost 8125 |
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
$secret = 'SESAME' | |
exec {'read_secret_variable': | |
command => '/bin/echo $ENVSECRET > /tmp/secret', | |
environment => "ENVSECRET=$secret" | |
} | |
# $ cat /tmp/secret | |
# SESAME |
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/sh | |
### BEGIN INIT INFO | |
# Provides: logstash-forwarder | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. |
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
root@salt:~# salt --async '*' cmd.run 'date ; sleep 10; date' | |
Executed command with job ID: 20150716111845948627 | |
root@salt:~# salt --async '*' cmd.run 'date ; sleep 10; date' | |
Executed command with job ID: 20150716111847963330 | |
root@salt:~# salt-run jobs.lookup_jid 20150716111845948627 | |
debian7: | |
Thu Jul 16 11:18:45 AEST 2015 | |
Thu Jul 16 11:18:55 AEST 2015 |
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
Get-AppxPackage | Select-String Zune | Remove-AppxPackage | |
Get-AppxPackage | Select-String Camera | Remove-AppxPackage | |
Get-AppxPackage | Select-String onenote | Remove-AppxPackage | |
Get-AppxPackage | Select-String phone | Remove-AppxPackage | |
Get-AppxPackage | Select-String photos | Remove-AppxPackage | |
Get-AppxPackage | Select-String BingSport | Remove-AppxPackage | |
Get-AppxPackage | Select-String Microsoft.People | Remove-AppxPackage | |
Get-AppxPackage | Select-String BingWeather | Remove-AppxPackage | |
Get-AppxPackage | Select-String WindowsSoundRecorder | Remove-AppxPackage | |
Get-AppxPackage | Select-String WindowsStore | Remove-AppxPackage |
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
# Remove all containers, inluding those that are not running. | |
docker ps --quiet | xargs docker kill | |
docker ps --all --quiet | xargs docker rm | |
# Remove all images. | |
docker images --format '{{.ID}}' | xargs docker rmi --force | |
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
apt-get -y update | |
apt-get -y install apt-transport-https ca-certificates | |
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /etc/apt/sources.list.d/docker.list | |
apt-get -y update | |
apt-get -y install docker-engine | |
service docker start | |
docker run hello-world |
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
#!/usr/bin/env python | |
import RPi.GPIO as GPIO | |
import picamera | |
import subprocess | |
# Set up a pin on the GPIO connector for the "record" button. | |
# We'll use pin 18, which is here: | |
# | |
# ....X........ |
OlderNewer