Skip to content

Instantly share code, notes, and snippets.

@dgonzo
dgonzo / gitaliases.sh
Last active February 1, 2018 00:00
helpful git aliases
# Helpful git aliases
# you can either add them one by one https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
# or format as you see them in ~/.gitconfig
alias.br=branch
alias.cb=checkout -B
alias.co=checkout
alias.lg=log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.lp=log -p -1
alias.mg=merge --no-ff
@dgonzo
dgonzo / logo.py
Created September 6, 2017 20:04
ZIFF Plain Text Logo
ziff_plain_text_logo = """
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
ZZZZZZZZ ZZZ ZZZZZ ZZZZ ZZZZZZ
ZZZZZZZZ ZZZ ZZZZZ ZZZZ ZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZ ZZZZZ ZZZZZZZZZZZ ZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZZ ZZZZZ ZZZZZZZZZZZ ZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZ ZZZZZ ZZZZZ ZZZZZZZZZZZ ZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZ ZZZZZZ ZZZZZ ZZZZZZZZZZZ ZZZZZZZZZZZZZZZ
@dgonzo
dgonzo / app.py
Created August 26, 2017 14:58
WSGI Apistar
from apistar import Include, Route
from apistar.frameworks.wsgi import WSGIApp as App
from apistar.handlers import docs_urls, static_urls
def welcome(name=None):
if name is None:
return {'message': 'Welcome to API Star!'}
return {'message': 'Welcome to API Star, %s!' % name}
@dgonzo
dgonzo / cVimrc
Last active February 7, 2017 17:32
cVim settings
let barposition = 'bottom'
let autoupdategist = 'true'
let blacklists = ["http://localhost/*", "https://mail.google.com/*", "http://0.0.0.0/*", "http://127.0.0.0/*"]
@dgonzo
dgonzo / .editorconfig
Last active September 6, 2016 02:52
System setup
root = true
# General
indent_style = space
indent_size = 2
tab_width = 2
# end_of_line
# insert_final_newline
trim_trailing_whitespace = true
max_line_length = 100
@dgonzo
dgonzo / predict.js
Last active November 29, 2019 20:28
Predictions with AWS Machine Learning w/ JavaScript (Node.js)
/*
Setup your aws account and create a credentials file:
$ mkdir ~/.aws # if it doesn't exist
$ cat <<'EOF' >> ~/.aws/credentials
[default]
aws_secret_access_key = "secret key"
aws_access_key_id = "your id"
EOF
Install aws module:
@dgonzo
dgonzo / LEAP.md
Last active July 8, 2016 04:15
LEAP Specification vAlpha

LEAP Specification version Alpha

LEAP is a specification for creating common-sense APIs for integrating advanced analytic* services around four basic processes; Label, Explore, Analyze, Predict (LEAP) that are HTTP-based and that conform to most or all of the principles of REST.

  • (e.g. machine learning, artificial intelligence, and visualization)

By following these conventions you will hopefully avoid confusion, increase adoption, become more productive, and be able to focus on what matters most: making full use of your data and other sources to make your applications and services smarter.

Services built around LEAP compliant specifications will surface APIs that are highly intuitive and they will provide clients with standard RESTful interfaces over HTTP.

@dgonzo
dgonzo / error
Last active April 15, 2016 10:46
9.2 letter counts
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-160-81dcb3a1b66b> in <module>()
----> 1 _ = words.apply(update_counts)
/Users/gonzo/.pyenv/versions/miniconda3-latest/lib/python3.5/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
2235 values = lib.map_infer(values, boxer)
2236
-> 2237 mapped = lib.map_infer(values, f, convert=convert_dtype)
2238 if len(mapped) and isinstance(mapped[0], Series):
FROM ubuntu:latest
MAINTAINER David Gonzalez "[email protected]"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y wget bzip2 freetds-dev && apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN echo 'export PATH=/opt/anaconda/bin:$PATH' > /etc/profile.d/conda.sh
RUN wget --quiet http://repo.continuum.io/miniconda/Miniconda3-3.6.0-Linux-x86_64.sh && \
/bin/bash /Miniconda3-3.6.0-Linux-x86_64.sh -b -p /opt/anaconda && \
FROM ubuntu:14.04
MAINTAINER Gonzo "[email protected]"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y wget bzip2 ca-certificates && apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN echo 'export PATH=/opt/anaconda/bin:$PATH' > /etc/profile.d/conda.sh
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh && \
/bin/bash /Miniconda-latest-Linux-x86_64.sh -b -p /opt/anaconda && \