Skip to content

Instantly share code, notes, and snippets.

View rozap's full-sized avatar

Chris Duranti rozap

View GitHub Profile
EQUIP_ID YEAR MAKE MODEL COLOR DESCRIPTION AUCTION HOUSE COMMENTS
12909 2001 GMC SAFARI WHITE PASSENGER MINIVAN BIDADOO ONLINE AUCTION
31479 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR MURPHYS AUCTION
31480 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR BIDADOO ONLINE AUCTION
31485 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR BIDADOO ONLINE AUCTION
31489 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR BIDADOO ONLINE AUCTION
31490 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR MURPHYS AUCTION
31493 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR BIDADOO ONLINE AUCTION
31494 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR BIDADOO ONLINE AUCTION
31498 2010 FORD CROWN VICTORIA BLUE/WHITE PATROL CAR - DUI MURPHYS AUCTION TOTALED (4/2016)
We can't make this file beautiful and searchable because it's too large.
Police Beat,CRIME_TYPE,CRIME_DESCRIPTION,STAT_VALUE,REPORT_DATE,Sector,Precinct,Row_Value_ID
B1,Homicide,Homicide,0,01/01/2008,B,N,1
B1,Rape,Rape,0,01/01/2008,B,N,2
B1,Robbery,Robbery,5,01/01/2008,B,N,3
B1,Assault,Assault,1,01/01/2008,B,N,4
B1,Larceny-Theft,Larceny-Theft,35,01/01/2008,B,N,5
B1,Motor Vehicle Theft,"Vehicle Theft is theft of a car, truck, motorcycle or any motor vehicle.",4,01/01/2008,B,N,6
B1,Burglary,Burglary,15,01/01/2008,B,N,7
B2,Homicide,Homicide,0,01/01/2008,B,N,8
B2,Rape,Rape,0,01/01/2008,B,N,9
@rozap
rozap / imports2.py
Created July 22, 2016 19:53
use imports2 from python
import urllib3
from urlparse import urlparse
import os
import json
from urllib import urlencode
from time import sleep
import pprint
import argparse
import sys
@rozap
rozap / foo.ex
Last active September 15, 2016 19:49
defmodule Foo do
def to_strings(m) when is_map(m) do
m
|> Enum.map(fn
{k, v} when is_integer(k) -> {Integer.to_string(k), to_strings(v)}
{k, v} -> {k, to_strings(v)}
end)
|> Enum.into(%{})
end
def to_strings(a_list) when is_list(a_list) do
@rozap
rozap / ldparse.py
Created October 7, 2016 17:14
parse ldjson
#!/usr/bin/python
import sys
import json
"""
cat ldjson-thing | ldjson msg,time
"""
def pick(row, path, label = ''):
if len(path) == 1:

~~elixirpalooza~~

Installing

Run brew install elixir

Learning

I'm not going to be able to do a better job giving an overview of the language than what's already documented here:

defmodule Advance do
defp advance_by(stream, count) do
Enumerable.reduce(stream, count, fn
x, {acc, 1} -> {:suspend, {[x | acc], 0}}
x, {acc, counter} -> {:cont, {[x | acc], counter - 1}}
end)
end
defp continue(cont, by) do
@rozap
rozap / chicago_crimes.ex
Last active January 25, 2017 21:41
elixir + socrata API
import Exsoda.Reader
with {:ok, rows} <- query("6zsd-86xi", domain: "data.cityofchicago.org")
|> select(["date_trunc_ym(date) as month", "count(*)"])
|> where("primary_type = 'HOMICIDE' AND month = '2001-01-01T00:00:00.000'")
|> group("month")
|> order("month")
|> run do
rows
def print_mem(label) do
case :erlang.process_info(self, :binary) do
{:binary, bins} ->
{size, count} = Enum.reduce(bins, {0, 0}, fn {_bid, size, count}, {s, c} -> {size + s, count + c} end)
Logger.warn("#{label} usage in #{__MODULE__} is #{size / 1000000}mb, #{count} of them")
_ -> :ok
end
end
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
To verify if it worked:
gcc -v