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 | |
import json | |
import boto3 | |
from bs4 import BeautifulSoup | |
from pprint import pprint | |
from datetime import datetime | |
# This code signs-in to Cost Explorer so that Reports can be created programmatically | |
# (At the moment of writing, this is not supported via officiel API) | |
# For some reasy, creating/updating reports requires different credentials than boto3-credentials obtains. Trying to create # a report fails with "status: 400". |
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 | |
from azure.identity import DefaultAzureCredential | |
# If you are trying to create a subscription in terraform running as a Service Principal, you might run into the following error: | |
# subscription.AliasClient#Create: Failure sending request: StatusCode=401 – Original Error: Code="UserNotAuthorized" Message="User is not authorized to create subscriptions on this enrollment account" | |
# Most help you'll find online will send you to this link: | |
# https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/assign-roles-azure-service-principals | |
# This script grants a service principal access to a billing account using the Azure Management API | |
# This script assumes you are logged in locally (with az login) as a user with proper permissions. |
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
#!/user/bin/python3.8 | |
from kafka import KafkaConsumer, KafkaProducer, KafkaAdminClient | |
from datetime import datetime, date | |
from time import sleep, monotonic_ns | |
import argparse | |
import json | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-b", "--kafka_broker", help="Set ip/hostname to kafka broker, host:port", type=str, required=True) |
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 usb.core | |
import usb.util | |
import sys | |
from pprint import pprint | |
# find our device with lsusb | |
# 046d:c53e | |
dev = usb.core.find(idVendor=0x046d, idProduct=0xc53e) | |
# was it found? |
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 | |
# Based on the following question from stack-exchange: | |
# https://devops.stackexchange.com/questions/2731/downloading-docker-images-from-docker-hub-without-using-docker | |
# Get token | |
TOKEN="$(curl --silent --header 'GET' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/ubuntu:pull" | jq -r '.token')" | |
# Get manifest | |
echo "Manifest: " |
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
#define _GNU_SOURCE | |
#include <sched.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <signal.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <unistd.h> |
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
version: '2' | |
volumes: | |
mysql: | |
services: | |
gitlab_app: | |
image: gitlab/gitlab-ce:11.9.0-ce.0 |
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 | |
from __future__ import print_function, absolute_import, division | |
import logging | |
import mysql.connector | |
from errno import ENOENT | |
from stat import S_IFDIR, S_IFREG | |
from time import time |
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/local/bin/python | |
# Example of TCP's threeway handshake using python and scapy | |
# source: https://www.fir3net.com/Programming/Python/how-to-build-a-tcp-connection-in-scapy.html | |
# Requires: | |
# iptables -A OUTPUT -p tcp --tcp-flags RST RST -j DROP | |
# Otherwise the kernel will send a TCP RESET as the kernel is not aware of TCP connection going on. | |
from scapy.all import * |
NewerOlder