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 requests | |
logstash_url = 'http://localhost:9200' | |
indices_limit = 10 | |
response = requests.get('%s/_stats' % logstash_url) | |
data = response.json() | |
def get_logstash_indices(data): | |
return [indice for indice in sorted(data['indices']) if indice.startswith('logstash')] |
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 time | |
from serial import Serial | |
conn = serial.Serial('/dev/rfcomm0', baudrate=57600) | |
while True: | |
conn.write('t') | |
time.sleep(.5) |
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
char c; | |
int led = 4; | |
int counter = 0; | |
void setup() | |
{ | |
Serial.begin(57600); | |
pinMode(led, OUTPUT); | |
} |
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 | |
SESSION=aws | |
SSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/it-coquelux.pem ubuntu" | |
FIRST=1 | |
for SERVER in $@ | |
do | |
if [ $FIRST -eq 1 ] | |
then |
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 | |
SESSION=aws | |
FIRST=1 | |
SSH="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/.ssh/it-coquelux.pem ubuntu" | |
IPS=`aws ec2 describe-instances \ | |
--filter 'Name=tag:Name,Values=WEBSERVER' \ | |
--output text \ | |
--query 'Reservations[*].Instances[*].PublicIpAddress'` |
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
#include <Servo.h> | |
#define SERVO_PIN 9 | |
Servo myServo; | |
byte i; | |
void setup() | |
{ |
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
var Cylon = require('cylon'); | |
Cylon.robot({ | |
connections: { | |
arduino: { | |
adaptor: 'firmata', | |
port: '/dev/ttyUSB0' | |
} | |
}, |
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/python | |
import sys | |
filename = '/etc/hosts.backup' | |
delimiter = '##aws-webservers' | |
if len(sys.argv) == 1: | |
print "Missing arguments" |
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 | |
aws ec2 describe-instances --filter 'Name=tag:Name,Values=WEBSERVER' --output text --query 'Reservations[*].I nstances[*].PublicIpAddress' |
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 | |
sudo cp /etc/hosts /etc/hosts.backup \ | |
&& python aws-update-hosts.py `aws-get-instances.sh` | sudo tee /etc/hosts |