Skip to content

Instantly share code, notes, and snippets.

View duncangh's full-sized avatar
💭
👨‍💻

Graham Duncan duncangh

💭
👨‍💻
View GitHub Profile
@xiantail
xiantail / ConvertAppleHealthXMLtoCSV.py
Last active January 28, 2021 22:16
Import XML file from Apple Health then convert to CSV file
import xml.etree.ElementTree as ET
import csv
import datetime
def convert_xml_to_csv(file_path):
with open(file_path, 'rb') as fd:
root = ET.parse(fd).getroot()
records = []
@simonw
simonw / awesomplete-ajax.html
Created April 27, 2018 06:47
Awesomplete ajax example.
<link rel="stylesheet" href="http://leaverou.github.io/awesomplete/awesomplete.css">
<script src="http://leaverou.github.io/awesomplete/awesomplete.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
const input = document.querySelector('input.blah');
const awesomplete = new Awesomplete(input);
input.addEventListener("awesomplete-selectcomplete", (ev) => console.log(ev.text));
input.addEventListener('keyup', (e) => {
var code = (e.keyCode || e.which);
if (code === 37 || code === 38 || code === 39 || code === 40 || code === 27 || code === 13) {
@goodhamgupta
goodhamgupta / yolo_to_voc.py
Last active July 10, 2025 20:04
Convert yolo coordinates to VOC format
# Script to convert yolo annotations to voc format
# Sample format
# <annotation>
# <folder>_image_fashion</folder>
# <filename>brooke-cagle-39574.jpg</filename>
# <size>
# <width>1200</width>
# <height>800</height>
# <depth>3</depth>
# Code adapted from Tensorflow Object Detection Framework
# https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb
# Tensorflow Object Detection Detector
import numpy as np
import tensorflow as tf
import cv2
import time
from time import sleep
print ("Welcome to the DCF calculator.")
def ask_perpetuity():
earnings = float(input("Enter last twelve months earnings: "))
discount_rate = float(input("Enter discount rate in %: "))/100
growth_rate = float(input("Enter future expected annual compounded growth rate in %: "))/100
growth_period = int(input("Enter amount of future years of growth, after which earnings will flatten: "))
@simecek
simecek / Map+Your+Twitter+Followers.ipynb
Last active August 7, 2021 05:35
Map your Twitter followers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Bernix01
Bernix01 / log.py
Created January 3, 2018 16:58
drf LogEntry viewset Mixin
'''
Extracted and modified from django-model-logging
It used it's own LogEntry model but since django
has it's own LogEntry maybe someone would want to
register in the same model instead of creating a
new one.
'''
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, ContentType, DELETION
from django.utils.translation import gettext as _
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 22, 2026 19:53
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@Sniedes722
Sniedes722 / app.py
Created November 12, 2017 23:30
Upload A File to an S3 Bucket with Flask
import os
import boto3
from flask import Flask, render_template, request, url_for, redirect
app = Flask(__name__)
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
S3_BUCKET = os.environ['S3_BUCKET']
aardvark
aardwolf
Aaronite
abaction
abaculus
abaissed
abampere
Abarambo
abasedly
abatable