Skip to content

Instantly share code, notes, and snippets.

View katzefudder's full-sized avatar
😼
I invented a timemachine next week

Florian Dehn katzefudder

😼
I invented a timemachine next week
View GitHub Profile
#!/bin/bash
# create and delete maintenance
set -e
GENIEKEY=YourOpsGenieKey
INTEGRATION_ID=YourIntegrationId
MAINTENANCE_DESCRIPTION="RepositorySyncronization"
# OpsGenie expects a format like yyyy-MM-dd'T'HH:mm:ssZ) (e.g. 2017-01-15T08:00:00+02:00)
@katzefudder
katzefudder / check_ec2_tags.sh
Last active May 14, 2020 14:52
Check for a TAG on your EC2 instance in AWS
#!/bin/bash
TAG_NAME="$1"
INSTANCE_ID="`wget -qO- http://instance-data/latest/meta-data/instance-id`"
REGION="`wget -qO- http://instance-data/latest/meta-data/placement/availability-zone | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"
echo $TAG_VALUE
@katzefudder
katzefudder / open_terminals_linux.sh
Last active July 14, 2021 08:52
Open a terminal/ssh session on each ec2 instance available in your AWS region with this oneliner
#!/bin/bash
aws ec2 describe-instances --region eu-west-1 --filter Name=tag:Name,Values=InstanceName --query 'Reservations[].Instances[].PrivateIpAddress' --output text | xargs -I {} gnome-terminal -x ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ~/my_keys/my-private-key.pem -o IdentitiesOnly=yes cloud-user@{}
@katzefudder
katzefudder / nodemcu.ino
Last active July 5, 2018 17:41
Amica NodeMCU Weather Project Sketch
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiUdp.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <DHT_U.h>
#include <Adafruit_BMP085.h>
#include <ntp.h>
#include <TimeLib.h>
#include <ACROBOTIC_SSD1306.h>
@katzefudder
katzefudder / Dockerfile
Last active December 6, 2022 07:44
AWS CLI dockerized with Alpine Linux
FROM alpine:3.14
ENV AWSCLI_VERSION "1.20.7"
RUN apk add --update \
python3 \
python3-dev \
py-pip \
build-base \
&& pip install awscli==$AWSCLI_VERSION --upgrade --user \
@katzefudder
katzefudder / Dockerfile
Created March 20, 2018 07:54
Get storage info from Artifactory
FROM golang:1.8
WORKDIR /go/src/app
COPY . .
RUN go-wrapper download && go-wrapper install
EXPOSE 9116
CMD ["go-wrapper", "run"] # ["app"]
@katzefudder
katzefudder / metering.py
Last active January 1, 2018 19:04
DHT11 + LDR on my RasPi
#!/usr/local/bin/python
import RPi.GPIO as GPIO
import time
import dht11
import graphitesend
#define the pin that goes to the circuit
pin_for_temp = 15
pin_for_light = 40
@katzefudder
katzefudder / Dockerfile
Created October 12, 2017 08:12
Ansible in a Container
FROM ubuntu:16.04
MAINTAINER Florian Dehn <flo@katzefudder.de>
RUN echo "deb http://archive.ubuntu.com/ubuntu/ xenial multiverse" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y python-pip openssh-client
RUN pip install --upgrade pip
@katzefudder
katzefudder / sh
Created September 10, 2017 08:30
send to graphite
#!/bin/bash
HOST=sub.host.domain
PORT=2003
echo "$1 $2 `date +%s`"|nc $HOST $PORT
@katzefudder
katzefudder / sh
Created September 10, 2017 08:29
send to statsd
#!/bin/bash
HOST=sub.host.domain
PORT=8125
METHOD=$1
KEY=$2
VALUE=$3
echo "$KEY:$VALUE|$METHOD"|nc -u -w 1 $HOST $PORT