Skip to content

Instantly share code, notes, and snippets.

group:q2 (imported from SQL)
Frequents = {
Customer:string, DrinkKiosk:string
'Alan' , 'All American'
'Joe' , 'The Califorian'
'John' , 'Bitter n Sour'
'Sue' , 'All American'
}
group:Test 1 (imported from SQL)
Customers = {
CustomerID:number, Name:string, Address:string, Country:string
1 , 'Marina' , 'Street A' , 'Belgium'
2 , 'Dave' , 'Street B' , 'Belgium'
3 , 'Mike' , 'Street C' , 'UK'
4 , 'Sylvie' , 'Street D' , 'France'
5 , 'Diane' , 'Street E' , 'France'
}
@moonraker595
moonraker595 / Dockerfile
Last active November 13, 2020 14:59
simple Dockerfile
#Use the standard python base OS image
FROM python:3
#Copy our files to the container
COPY . ./app
#Change the working directory to /app
WORKDIR /app
#Install the required python packages listed in the requirements file
RUN python -m pip install -r requirements.txt
#Expose port 5000 of the container to the outside
EXPOSE 5000
@moonraker595
moonraker595 / hello_world.py
Last active November 13, 2020 15:00
simple web app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(host='0.0.0.0')
@moonraker595
moonraker595 / main.go
Last active September 29, 2020 07:29
package main
import (
"fmt"
"errors"
)
// User example Struct
type User struct {
ID int
@moonraker595
moonraker595 / main.go
Last active September 29, 2020 07:29
Go simple function
package main
import (
"fmt"
"errors"
)
// User example Struct
type User struct {
ID int
@moonraker595
moonraker595 / docker-compose.yaml
Last active June 29, 2020 14:11
metrics docker-compose file
version: '3.5'
services:
app:
restart: always
build: .
image: api
container_name: app
ports:
@moonraker595
moonraker595 / prometheus.yml
Created June 29, 2020 11:41
setting up the Prometheus server config
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
@moonraker595
moonraker595 / output.txt
Last active June 29, 2020 11:38
metrics output
# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 15536.0
python_gc_objects_collected_total{generation="1"} 1490.0
python_gc_objects_collected_total{generation="2"} 20.0
# Lots more stuff
# HELP my_counter_total Request Counter
# TYPE my_counter_total counter
@moonraker595
moonraker595 / s3.py
Last active June 30, 2020 18:25
creating a promethues metric example
from rest_framework import generics, status
from rest_framework.response import Response
from utils.metrics_common import *
def post(self, request):
"""
Create an s3 bucket
"""
Metrics.upload_urls_created.inc()