Skip to content

Instantly share code, notes, and snippets.

Avatar

bikemule

  • Kraken Technologies
  • Brooklyn, NY
View GitHub Profile
View sql_murder_mystery.sql
/*
select * from crime_scene_report where type='murder' and city='SQL City';
date type description city
20180215 murder REDACTED REDACTED REDACTED SQL City
20180215 murder Someone killed the guard! He took an arrow to the knee! SQL City
20180115 murder Security footage shows that there were 2 witnesses. The first witness lives at the last house on "Northwestern Dr". The second witness, named Annabel, lives somewhere on "Franklin Ave". SQL City
select * from interview where person_id in (select id from person where address_street_name like '%Northwestern Dr%' or address_street_name like '%Franklin Ave%');
Perhaps a way to narrow it down more, but the last two rows say:
@bikemule
bikemule / graph_models.sh
Last active Mar 21, 2020
Django model graph of specific apps, grouped by app, without inheritance
View graph_models.sh
# Graph the models of specified apps.
# manage.py graph_models arguments:
# -g = Group models by app.
# -E = Do not show model inheritance.
# --output output_file, used with --pygraphviz
# `date --rfc-3339=date` = YYYY-MM-DD
python manage.py graph_models --pygraphviz -gE --output modelsgraph-`date --rfc-3339=date`.png appname1 appname2
View 538_the_riddler_04272018.py
'''
Don't know why I wanted to document this in such detail, but here it is.
From: https://fivethirtyeight.com/features/how-fast-can-you-type-a-million-letters/
Some number, N, of people need to pee, and there is some number, M, of urinals
in a row in a men's room. The people always follow a rule for which urinal they
select: The first person goes to one on either far end of the row, and the rest
try to maximize the number of urinals between them and any other person. So the
second person will go on the other far end, the third person in the middle, and
View explain_self.py
# Trying to explain self in Python
class Number:
class_value = 1
def __init__(self, value):
# self is used here to refer to the newly created obj because __init__ is magic and it's a constructor
# All OO langs have to have constructors
self.value = value
@bikemule
bikemule / gist:4973606b6ffae233608d
Created Mar 9, 2015
pip install pgmagick error log
View gist:4973606b6ffae233608d
This file has been truncated, but you can view the full file.
Collecting django==1.6.6 (from -r requirements.txt (line 1))
Downloading Django-1.6.6-py2.py3-none-any.whl (6.7MB)
Collecting psycopg2==2.5 (from -r requirements.txt (line 2))
Downloading psycopg2-2.5.tar.gz (703kB)
Collecting pycurl==7.19.0 (from -r requirements.txt (line 3))
Downloading pycurl-7.19.0.tar.gz (70kB)
Using curl-config (libcurl 7.30.0)
Collecting dateutils==0.6.6 (from -r requirements.txt (line 4))
@bikemule
bikemule / gist:3dce8a886c9b80f6801f
Created Mar 9, 2015
brew install pgmagick error OS X 10.9.4
View gist:3dce8a886c9b80f6801f
/usr/local/include/boost/python/class.hpp:266:11: note: candidate function template not viable: requires 5 arguments, but 2 were provided
self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3)
^
1 error generated.
error: command 'clang' failed with exit status 1