Skip to content

Instantly share code, notes, and snippets.

Liftoff #fpvracing

Craig Derington craigderington

Liftoff #fpvracing
  • Craig Derington
Block or report user

Report or block craigderington

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
craigderington /
Created Mar 8, 2019
DRF by Example Root URLs Module
from django.urls import path
from django.conf.urls import include
from django.conf import settings
from django.contrib import admin
from rest_framework_swagger.views import get_swagger_view
from .views import api_root
schema_view = get_swagger_view(title='DRF by Example')
# url list
craigderington /
Last active Oct 29, 2019
Read in a CSV file and POST the data to an API Endpoint
import argparse
import csv
import json
import os
import requests
import sys
from requests.auth import HTTPBasicAuth
from urllib.parse import urlparse
craigderington / Dockerfile
Last active Sep 12, 2019
Build image for Flask Redis Counter
View Dockerfile
FROM python:3.6-alpine
LABEL maintainer="Craig Derington <>"
RUN apk update && apk upgrade
RUN apk add screen curl
COPY . /app
RUN pip install -r requirements.txt
CMD ["python", ""]
craigderington /
Created Sep 12, 2019
Python + Flask + Redis - Page Hit Counter
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host="", port=6379)
@app.route("/", methods=["GET"])
craigderington /
Created Jul 12, 2019
Python while True loop updating Incoming Message UUID when Certain Conditions Exist
import os
import time
import uuid
import random
from datetime import datetime, timedelta
def get_message():
return uuid.uuid4()
craigderington /
Created May 6, 2019
Create a Hash of a File
import os
import hashlib
def sha256sum(filename):
Create a file hash
:param: str (file path)
:return: str (md5 hash)
h = hashlib.sha256()
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
if __name__ == '__main__':
#! usr/bin/python3.6
# coding: utf-8
import time
from functools import wraps
def my_logger(func):
import logging
logging.basicConfig(filename='{}.log'.format(str(func.__name__)), level=logging.DEBUG)
craigderington /
Created Mar 14, 2019
Python - Check Array Frequency
the_list = [1, 3, 7, 9, 12, 3, 9, 12, 9, 10, 14, 23, 12]
def analyze_list(l):
counts = {}
for item in l:
if item in counts:
counts[item] += counts[item]
counts[item] = 1
# -*- coding: utf-8 -*-byte1 ^ byte2 ^
# vars
checksum = 0
checksum_xor = 0
n = 2
# raw data
radio_09010 = '02040d3031000010723320000a100000363303'
You can’t perform that action at this time.