Skip to content

Instantly share code, notes, and snippets.

View stepankuzmin's full-sized avatar
🥡

Stepan Kuzmin stepankuzmin

🥡
View GitHub Profile
@stepankuzmin
stepankuzmin / docker-compose.yml
Created November 28, 2016 13:25
Galton Docker Compose example
version: '2'
services:
galton_dnsmasq:
image: andyshinn/dnsmasq:2.76
restart: always
container_name: galton_dnsmasq
cap_add:
- NET_ADMIN
galton_nginx:
image: nginx
@stepankuzmin
stepankuzmin / connection.py
Created December 1, 2016 12:38
Jupyter Notebook Python GIS Stack with host PostgreSQL support example
import psycopg2
conn = psycopg2.connect("dbname=db host=/var/run/postgresql/ user=user")
cur = conn.cursor()
cur.execute("select * from datasets.intervals;")
cur.fetchone()
cur.close()
conn.close()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stepankuzmin
stepankuzmin / ramda-utils.js
Last active December 19, 2016 12:35
My Ramda helpers
const R = require('ramda');
const mapIndexed = R.addIndex(R.map);
// notEmpty : a -> Bool
const notEmpty = R.converge(R.compose(R.not, R.or), [isNaN, R.isEmpty]);
// buildDict : String -> [{ k: v }] -> { k: v }
const buildDict = R.uncurryN(2, key => R.pipe(
R.map(R.compose(R.toLower, R.prop(key))),

Keybase proof

I hereby claim:

  • I am stepankuzmin on github.
  • I am stepankuzmin (https://keybase.io/stepankuzmin) on keybase.
  • I have a public key ASCTIo2LNjSpYsNdpAt8RuqIfr8_ORUCtsPkkXO28Cp3ZQo

To claim this, I am signing this object:

@stepankuzmin
stepankuzmin / group-by-15-minutes.sql
Last active July 19, 2017 14:29
Group by 15 minutes interval
with
avg_by_hour as (
select
id,
date_trunc('hour', time) + (round(extract('minute' from time) / 15) * 15) * interval '1 minute' as interval,
trunc(avg(free)) as free
from velobike_2016_09_05
group by id, interval
order by id, interval
)
version: '2'
services:
fluentd:
container_name: fluentd
image: fluent/fluentd
environment:
FLUENTD_CONF: fluent.conf
ports:
- 24224:24224
import { call, put, takeLatest } from 'redux-saga/effects';
import { AUTH_REQUEST, AUTH_SUCCESS, AUTH_FAILURE } from './reducer';
const fetchJSON = (url, options = {}) =>
new Promise((resolve, reject) => {
return fetch(url, options)
.then(response => (response.status !== 200 ? reject(response) : response))
.then(response => response.json())
.then(response => resolve(response))
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import { ConnectedRouter } from 'react-router-redux';
import Main from './Main';
import Login from './Login';
const App = props => {
const { history } = props;
import React from 'react';
import ReactDOM from 'react-dom';
import createHistory from 'history/createBrowserHistory';
import createSagaMiddleware from 'redux-saga';
import { Provider } from 'react-redux';
import { routerMiddleware } from 'react-router-redux';
import { applyMiddleware, createStore } from 'redux';
import App from './App';
import Saga from './saga';