This file contains hidden or 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
class InventoryViewSet(viewsets.ModelViewSet): | |
keycloak_scopes = { | |
'GET': 'invetory:view', | |
'POST': 'inventory:add', | |
'PUT': 'inventory:update', | |
'DELETE': 'inventory:delete' | |
} | |
serializer_class = InventorySerializer | |
queryset = Inventory.objects.all().order_by('inventory_id') | |
filter_backends = (filters.DjangoFilterBackend, ) |
This file contains hidden or 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: '3.6' | |
services: | |
superset: | |
image: amancevice/superset:0.25.6 | |
ports: | |
- "8088:8088" | |
volumes: | |
- ./superset-conf/config:/etc/superset | |
- ./superset-conf/templates/appbuilder/navbar.html:/usr/local/lib/python3.5/dist-packages/superset/templates/appbuilder/navbar.html |
This file contains hidden or 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
''' | |
Generic object to dict converter. Recursively convert. | |
Useful for testing and asserting objects with expectation. | |
''' | |
def todict(obj, classkey=None): | |
if isinstance(obj, dict): | |
data = {} | |
for (k, v) in obj.items(): | |
data[k] = todict(v, classkey) |
This file contains hidden or 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
''' | |
Used for testing purpose, during development. Not for production | |
''' | |
def distance_between_two_geo_coordinates(start_lat, start_long, end_lat, end_long): | |
from math import radians, sin, cos, acos | |
print("Input coordinates of two points:") | |
slat = radians(start_lat) | |
slon = radians(start_long) | |
elat = radians(end_lat) |
This file contains hidden or 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
FROM node:10.15.2-alpine | |
WORKDIR /home/app | |
EXPOSE 3000 3000 | |
ADD yarn.lock package.json ./ | |
RUN yarn install | |
COPY . . | |
ENTRYPOINT [ "yarn","start" ] |
This file contains hidden or 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
docker build -t myapp . |
This file contains hidden or 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: "3" | |
services: | |
postgres: | |
image: postgres:11.2-alpine | |
environment: | |
POSTGRES_PASSWORD: '!abcd1234' | |
POSTGRES_USER: purplecow | |
POSTGRES_DB: purple_cow | |
volumes: | |
- ./postgres-data:/var/lib/postgresql/data |
This file contains hidden or 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
package java_experiments; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.Properties; | |
/* | |
* This class helps to convert a property file entries into cloudformation script to add them as SSM::Parameter |
This file contains hidden or 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
FROM openresty/openresty:alpine-fat | |
RUN mkdir /var/log/nginx | |
RUN apk add --no-cache openssl-dev | |
RUN apk add --no-cache git | |
RUN apk add --no-cache gcc | |
RUN luarocks install lua-resty-openidc | |
ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] |
This file contains hidden or 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
server { | |
listen 80 default_server; | |
root /opt/nginx/html; | |
resolver 127.0.0.11 valid=1s ipv6=off; | |
access_by_lua ' | |
local opts = { | |
redirect_uri_path = "/redirect_uri", | |
accept_none_alg = true, | |
discovery = "http://host.docker.internal:3333/auth/realms/myrealm/.well-known/openid-configuration", | |
client_id = "nginx", |