Skip to content

Instantly share code, notes, and snippets.

@azwdevops
azwdevops / gist:bea563b5a2c08598d40fc5c1ef85d079
Created May 24, 2024 17:04
Pre-commit hooks to run tests in django application, and abort commit if tests fail, otherwise continue with commit
#!/usr/bin/env python
import subprocess
import sys
def run_tests():
result = subprocess.run(
['pytest'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return result.returncode
@azwdevops
azwdevops / gist:5995cac82aa31606f612960d17f0de53
Created April 19, 2024 07:06
An SQL gist to create company table and run various queries to extract data from MYSQL DB
CREATE DATABASE company_db;
USE company_db;
-- CREATE TABLES
CREATE TABLE employee(
emp_id INT PRIMARY KEY,
first_name VARCHAR(20),
last_name VARCHAR(20),
birth_date DATE,
sex VARCHAR(1),
salary INT,
@azwdevops
azwdevops / gist:10029310ec2a5a649a479a4d8893c577
Created February 24, 2024 10:41
A simple appspec.yml file for AWS codedeploy
version: 0.0
os: linux
hooks:
ApplciationStop:
- location: scripts/stop_container.sh
timeout: 300
runas: root
AfterInstall:
- location: scripts/start_container.sh
@azwdevops
azwdevops / gist:d74adcc22c810c9d5f978a3d053ceb52
Created February 24, 2024 06:41
a simple gist for aws buildspec to create a code build in aws
version: 0.2
env:
parameter-store:
DOCKER_REGISTRY_USERNAME: /myapp/docker-credentials/username
DOCKER_REGISTRY_PASSWORD: /myapp/docker-credentials/password
DOCKER_REGISTRY_URL: /myapp/docker-registry/url
phases:
install:
@azwdevops
azwdevops / gist:4dd6f7139f3601e40ba643baba483e6a
Created February 23, 2024 21:20
A simple dockerfile to create a container for a flask app
# a simple Dockerfile to create a container for a flask app
FROM python:3.8
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
@azwdevops
azwdevops / post-receive
Created May 23, 2022 16:00 — forked from rudyryk/post-receive
Git post-receive hook sample for basic Django project
#!/usr/bin/env python
#
# No Rights Reserved
# http://creativecommons.org/publicdomain/zero/1.0/
"""Git post-receive hook script
Suggested project structure::
/home/$_USER/
env/