Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Devopsing, Dockerising, Grafanasing, Keycloaking, Clouding, Lambdasing,...

Jan Garaj jangaraj

💭
Devopsing, Dockerising, Grafanasing, Keycloaking, Clouding, Lambdasing,...
View GitHub Profile
@jangaraj
jangaraj / remote_pb2.py
Created Jul 29, 2022
Promtheus python proto files
View remote_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: remote.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
@jangaraj
jangaraj / nbf.js
Created Oct 23, 2021
NBF scripted mapper for Keycloak OIDC clients
View nbf.js
# don't use Math.round, because it may round it into the
# future and it may be a problem for implementation, where
# nbf claim is verified
secondsSinceEpoch = Math.floor(new Date().getTime()/1000)
exports secondsSinceEpoch
@jangaraj
jangaraj / app.py
Last active Nov 10, 2020
Connect to Endomondo API with local credentials
View app.py
import requests
import uuid, socket
class Endomondo:
# user your own non OIDC credentials here
email = "<EMAIL>"
password = "<PASSWORD>"
country = 'GB'
device_id = str(uuid.uuid5(uuid.NAMESPACE_DNS, socket.gethostname()))
@jangaraj
jangaraj / Dockerfile
Last active Jul 7, 2020
Dockerfile to build pyodbc and unixODBC for MSSQL as a lambda layer for Python 3.8 in the Dockerfile
View Dockerfile
# inspired by https://gist.github.com/diriver63/b72a954fa0da4851d89e5086aa13c6e8
# build from online Dockerfile (use always URL to the latest Dockerfile):
# docker build --rm=true -t local/pyodbc-layer https://gist.githubusercontent.com/jangaraj/bf9a1bbf71bd6d4b9616828b29096d19/raw/a3a5f35dbafd50b9623c9d3886cb3f4b2d800d92/Dockerfile
# build from the local Dockerfile
# docker build --rm=true -t local/pyodbc-layer .
# copy pyodbc-layer.zip from the image and destroy image
# docker run -d --name delme local/pyodbc-layer sleep 1000 && docker cp delme:/tmp/pyodbc-layer.zip . && docker rm -f delme && docker rmi -f local/pyodbc-layer
@jangaraj
jangaraj / pyodbc-unixODBC-lambda-layer
Last active Jun 22, 2021 — forked from diriver63/pyodbc-unixODBC-lambda-layer
pyodbc and unixODBC for MSSQL as a lambda layer - Python 3.8
View pyodbc-unixODBC-lambda-layer
# use https://github.com/lambci/docker-lambda to simulate a lambda environment
docker run -it --rm \
--entrypoint bash \
-e ODBCINI=/opt/odbc.ini \
-e ODBCSYSINI=/opt/ \
-v $PWD:/export \
lambci/lambda:build-python3.8
# download and install unixODBC
# http://www.unixodbc.org/download.html
@jangaraj
jangaraj / Dockerfile
Created Oct 5, 2018
Keycloak-gatekeeper
View Dockerfile
FROM golang:1.11 as build
ARG VERSION=master
ARG GOOS=linux
ARG GOARCH=amd64
ENV AUTHOR keycloak
ENV NAME keycloak-gatekeeper
RUN go get -v -d github.com/$AUTHOR/$NAME 2>/dev/null; \
cd $GOPATH/src/github.com/$AUTHOR/$NAME \
&& git checkout $VERSION \
&& sed -i 's/keycloak-proxy/keycloak-gatekeeper/g' Makefile \
@jangaraj
jangaraj / aws_lambda_backup_grafana_dashboards.py
Last active Dec 6, 2018
AWS Lambda Function to backup Grafana 5+ dashboards into S3
View aws_lambda_backup_grafana_dashboards.py
# multiprocess Lambda function to backup all Grafana dashboards to S3 bucket
import datetime, boto3
from botocore.vendored import requests
from multiprocessing import Process, Pipe
config = {
'domain.com': {
'url': 'https://domain.com',
'key': '=grafana-api-key-with-read-permissions-for-all-dashboards=',
View gist:d741a11ef59b6f5abe3ed534c66533c8
BITS 32
org 0x05000000
db 0x7F, "ELF"
dd 1
dd 0
dd $$
dw 2
dw 3
dd 0x0500001B
View metais.py
#!/usr/bin/env python
import json, requests
debug = 0
'''
Examples:
# time ./metais.py > /tmp/metais.stats
real 16m57.925s
user 6m4.204s
@jangaraj
jangaraj / aws-grafana-policy.json
Last active Nov 2, 2016
aws-grafana-policy.json
View aws-grafana-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:Describe*",
"cloudwatch:Describe*",
"cloudwatch:Get*",
"cloudwatch:List*"