Skip to content

Instantly share code, notes, and snippets.

View craigderington's full-sized avatar
🚀
Automate Everything

Craig Derington craigderington

🚀
Automate Everything
View GitHub Profile
class Location(BaseAddress, TimeStampedModel):
location_name = models.CharField(max_length=50, blank=False, null=False)
default_location = models.BooleanField(default=False)
def __unicode__(self):
if self.location_name and self.city:
return unicode(str(self.location_name + '-' + self.city))
class Meta:
verbose_name = 'Location'
from django.contrib import admin
from django.forms.models import BaseInlineFormSet
from .models import Item, ItemLocation
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
fieldsets = (
('Item Details', {
'fields': ('sku', 'item_name', 'item_description', 'item_search',
#!/bin/bash
# Pretty Welcome Message
echo -e " *************************************************** "
echo -e " *************************************************** "
echo -e " Amazon S3 Restore MySQL Databases "
echo -e " 4-18-2017 - Craig Derington "
echo -e " GitHub @craigderington "
echo -e " "
echo -e " *************************************************** "
@craigderington
craigderington / tmux-cheatsheet.markdown
Created August 11, 2017 17:44 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Keybase proof

I hereby claim:

  • I am craigderington on github.
  • I am craigderington (https://keybase.io/craigderington) on keybase.
  • I have a public key ASCbUM40Q7LxGnKSPW-ar29OyIwHMIHdiFCvctV6uhsAJQo

To claim this, I am signing this object:

@craigderington
craigderington / urls.py
Created March 8, 2018 14:26
Django URLs Example
# urls.py
from django.conf.urls import url
from views import CustomerListView
urlpatterns = [
url(r'^customers/$', CustomerListView.as_view()),
]
@craigderington
craigderington / de_duplicate.py
Last active June 25, 2018 16:46
De-duplicate two lists. List A contains all records. List B contains a subset of List A. Produce a clean list A NOT IN B.
# *-* coding: utf-8 *-*
lst_a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
lst_b = [1, 4, 5, 7, 9, 11, 14]
def de_duplicate(l1, l2):
"""
Return a de-duplicated list
:param l1: list splash visitor
@craigderington
craigderington / clean_dict.py
Last active August 10, 2018 18:20
Create a Clean List from 2 Dictionaries by Filter on Key
# *-* coding: utf-8 *-*
import csv
d = {}
j = {}
followups = []
with open('data/campaign1.csv', 'r') as f1:
@craigderington
craigderington / ppm_score.py
Last active August 7, 2018 19:28
Calculate the PPM score from Visitor's Appended Data
#! *-* coding: utf-8 *-*
import csv
import config
import requests
from datetime import datetime
today = datetime.now()
@craigderington
craigderington / udger_testing.py
Last active August 8, 2018 15:12
Python script for testing various Udger parsing functions
# -*- coding: utf-8 -*-
import csv
import xml.etree.ElementTree as ET
import logging
import ipaddress
from udger import Udger
from db import db_session
from sqlalchemy import text