Skip to content

Instantly share code, notes, and snippets.

@raiderrobert
raiderrobert / views.py
Last active April 23, 2017 23:10
M2M delete Example with GET
class RemoveStudent(DeleteView):
model = Course
template_name = 'course_detail.html'
def delete(self, request, *args, **kwargs):
self.object = self.get_object()
user = User.objects.get(pk=self.kwargs['user_pk'])
self.object.students.remove(user)
return HttpResponseRedirect(reverse_lazy('courses.detail', kwargs={'pk': self.object.pk}))
@raiderrobert
raiderrobert / area.py
Created May 17, 2017 02:11
Demo Area function
def area (height, width, length):
return ((height * length) * 2) + ((height * width) * 2)
"""
The world is a horrible place.
Let's make it better about knowing how sharp some knives are.
from Raymond Hettinger and Python Anti-Patterns
"""
# -*- coding: utf-8 -*-
"""
Created on Wed May 24 14:40:50 2017
Requirements:
1. Read URL
2. Loop function to crawl through the following pages after the first page in the data catalogue
2. For every data node, go inside and crawl the resource links
3. Test each link for 404 errors
4. Return result into a pandas dataframe
# -*- coding: utf-8 -*-
"""
Created on Wed May 24 14:40:50 2017
Requirements:
1. Read URL
2. Loop function to crawl through the following pages after the first page in the data catalogue
2. For every data node, go inside and crawl the resource links
3. Test each link for 404 errors
4. Return result into a pandas dataframe
"""
The world is a horrible place.
Let's make it more pythonic
many ideas borrowed from Raymond Hettinger and Python Anti-Patterns
"""
# timeit is a Python built in that can test small snippets very quickly
# by default it'll run the code snippet 1 million times
@raiderrobert
raiderrobert / readme.md
Created January 31, 2018 14:29
DEP - Temporary Table

CREATE TEMPORARY TABLE cross_inventory AS SELECT * FROM inventory WHERE /* complex clause here */;

CREATE INDEX cross_inv_sku ON cross_inventory(sku);

@raiderrobert
raiderrobert / pytn2018-opening-keynote.txt
Last active February 10, 2018 16:10
PyTenneesee 2018 - Opening Keynote by Safia Abdalla
615-873-0382 - Code of Conduct Violations
PYTN2018
Keynote - Safia Abdalla, @captainsafia
- 10 days to submit 1st PR on Github: 1 char change on pandas
Open Source is the sum of small parts
You're one degree away from someone who can help you do something great
The best mentorship relationships are actually really good friendships.
- Being a human being in technology matters
@raiderrobert
raiderrobert / pytn2018-testing-the-infrastructure.txt
Last active February 10, 2018 16:54
PyTenneesse 2018 - Testing the Infrastructure by Sean Marlow
Testing the Infrastructure by Sean Marlow, 10:15am Saturday
Verifying the state of IaC and public cloud images with Python
slides here: https://smarlowucf.github.io/presentations/testing_infra/
(so fewer notes than I would do otherwise)
We have a bunch of tools that make it easier to deploy now rapidly
But now we can propogate a typo quickly
Our infrastructure is code. All code deserves tests.
@raiderrobert
raiderrobert / pytn2018-hands-on-machine-learning-with-scikit.txt
Created February 11, 2018 00:17
PyTenneesse 2018 - Hands on Machine Learning with Scikit-Learn by John Berryman 1pm Saturday
Hands on Machine Learning with Scikit-Learn by John Berryman 1pm Saturday
Twitter - @JnBrymn
Slides - http://slides.com/johnberryman/deck-10/fullscreen#/
Hands-On Machine Learning with Scikit-Learn & TensorFlow
Types of Machine Learning
- Supervised
- Unsupervised