Skip to content

Instantly share code, notes, and snippets.

@jsheedy
jsheedy / Dockerfile
Created July 2, 2018 19:17
dockerfile-compose for a celery worker with autoreload on code change
FROM python:3.6
RUN mkdir /app
ADD requirements.txt /app/
WORKDIR /app/
RUN pip install -r requirements.txt
CMD [ \
"watchmedo", \
"auto-restart", \
#
# https://docs.gdax.com/#websocket-feed
#
import websocket
import sys
from datetime import datetime, timedelta, timezone
import sched, time
import json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ximeg
ximeg / ThresholdingAlgo.py
Created April 20, 2017 07:20
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
#!/usr/bin/env python
# Implementation of algorithm from http://stackoverflow.com/a/22640362/6029703
import numpy as np
import pylab
def thresholding_algo(y, lag, threshold, influence):
signals = np.zeros(len(y))
filteredY = np.array(y)
avgFilter = [0]*len(y)
stdFilter = [0]*len(y)
@zduey
zduey / iex.py
Created March 4, 2017 16:04
Simple Real-Time Stock Streaming with Bokeh
import io
import requests
import pandas as pd
from bokeh.models import ColumnDataSource, HoverTool, ResizeTool, SaveTool
from bokeh.models.widgets import TextInput, Button
from bokeh.plotting import figure, curdoc
from bokeh.layouts import row, widgetbox
TICKER = ""
@spinscale
spinscale / kv.json
Created December 19, 2016 14:27
kv in painless
POST _ingest/pipeline/_simulate
{
"pipeline" : {
"description": "A pipeline to do named entity extraction",
"processors": [
{
"script": {
"lang": "painless",
"inline": "ctx.params = [:] ; /&/.splitAsStream(ctx.x).forEach(pair -> { def x = /=/.split(pair); ctx.params[x[0]] = x[1]; })"
}

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@mbonaci
mbonaci / esexport.py
Created April 12, 2016 19:52
Elasticsearch export by time range using Python scroll API
#!/usr/bin/env python
# encoding: utf-8
'''
Elasticsearch export using Python ES client's scroll feature
@author: mbonaci
@copyright: 2016 Sematext. All rights reserved.
@license: Apache 2.0
@contact: [email protected]
'''
@waveform80
waveform80 / motion_215.py
Last active September 8, 2021 16:23
Motion detection with a circular buffer and file recording in picamera
#!/usr/bin/env python
import io
import time
import picamera
import picamera.array
import numpy as np
from PIL import Image, ImageDraw