Skip to content

Instantly share code, notes, and snippets.

View rozap's full-sized avatar

Chris Duranti rozap

View GitHub Profile

~~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:

@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:
@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
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
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)
foo bar
1 2
defmodule KVStore do
use GenServer
# This executes within the supervisor or whoever starts the KVStore
def start_link do
# First arg is the callback module (this module)
# The name arg registers the process globally as `KVStore`, essentially making it a singleton
GenServer.start_link(KVStore, [], name: KVStore)
end
@rozap
rozap / gist:8571817
Created January 23, 2014 02:33
hehehe
import sys
import telnetlib
import re
HOST = "localhost"
tn = telnetlib.Telnet(HOST, 8000)
def _(msg, expected):
tn.write(msg + '\n')
- name: Setup python and repos
hosts: testing
sudo_user: cms
user: ansible
vars_files:
- vars/vars.yml
roles:
- {role: appserver, sudo: no, ansible_python_interpreter: '/var/sites/lbsappserver/bin/pyvenv'}
- {role: queue, sudo: yes, ansible_python_interpreter: '/var/sites/lbsappserver/bin/pyvenv'}
@rozap
rozap / gist:7635563
Created November 25, 2013 02:56
record screen with ffmpeg
ffmpeg -y -f alsa -ac 2 -i pulse -f x11grab -r 25 -s 1920x1080 -i :0.0 -vcodec libx264 -vpre lossless_ultrafast -crf 22 -acodec libmp3lame -ar 44100 -ab 126k -threads 3 ~/Desktop/screencast.mkv