Skip to content

Instantly share code, notes, and snippets.

View leventyalcin's full-sized avatar
💭
Available to hire

Levent Yalcin leventyalcin

💭
Available to hire
View GitHub Profile
DEFAULT_GOAL := help
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@leventyalcin
leventyalcin / dht.py
Created January 17, 2021 21:18
DHT data as Prometheus metrics
#!/usr/bin/env python3
import sys
import Adafruit_DHT
from prometheus_client import start_http_server, Gauge
import time
import logging
import logging.handlers
logging.basicConfig(level=logging.NOTSET)
# Slack command generator for AWS status feeds of the default region
for i in $(curl -q -o- http://status.aws.amazon.com | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | grep $AWS_DEFAULT_REGION | awk -F'"' '{print $2}'); \
do \
echo "/feed subscribe http://status.aws.amazon.com$i"; \
done

Keybase proof

I hereby claim:

  • I am leventyalcin on github.
  • I am leventyalcin (https://keybase.io/leventyalcin) on keybase.
  • I have a public key ASDxttjwLSfdgaaP8zGamQnKIl3aFjnuowbft9PVEixt3wo

To claim this, I am signing this object:

# It's ok
"UserData":{
"Fn::Base64":{
"Fn::Join":[
"",
[
"#!/bin/bash\n",
"yum update -y\n",
"command\n",
"command\n",
#!/bin/bash
tshark -l -2 -R \
'(dns.qry.name == "DOMAINNAME.COM" or dns.qry.name == "SUB.DOMAIN.COM") and dns.response_to' \
-T fields \
-e frame.time \
-e dns.time \
-e dns.qry.name \
-e dns.resp.addr \
>> ALL_DNS_RESULTS
@leventyalcin
leventyalcin / vardump.j2
Created October 19, 2015 01:12
Ansible var dump template
Module Variables ("vars"):
--------------------------------
{{ vars | to_nice_json }}
Environment Variables ("environment"):
--------------------------------
{{ environment | to_nice_json }}
GROUP NAMES Variables ("group_names"):
--------------------------------
#!/bin/bash
USER='root'
PASS='demoserver'
HOST='localhost'
BACKUPDIR='/backup'
IGNOREDBS='information_schema performance_schema'
RETENTION=14
@leventyalcin
leventyalcin / onliner.sh
Last active October 14, 2016 18:37
Recover deleted files on Amazon S3
aws --output=text --profile=PROFILE s3api list-object-versions --bucket BUCKET_NAME --region=REGION --prefix=DIRNAME \
| grep -e "DELETEMARKERS\tTrue" \
| while read LINE \
do \
KEY=`echo $LINE | awk '{print $3}'` VERSION=`echo $LINE | awk '{print $NF}'` \
aws --profile=PROFILE s3api delete-object --bucket BUCKET_NAME --key $KEY --version-id $VERSION --region=REGION \
done