Skip to content

Instantly share code, notes, and snippets.

View stavinsky's full-sized avatar

Anton Stavinsky stavinsky

View GitHub Profile
@stavinsky
stavinsky / ngram.py
Created April 9, 2018 12:46
simple ngram for russian texts
import re
class NGram():
pattern = re.compile('[^а-яА-Я ]+')
_ngrams = dict()
_it = 0
def __init__(self):
self.words = dict()
self._it = 0
@stavinsky
stavinsky / readme.md
Last active June 15, 2017 09:53
utils

add got_chars((char *)Buf, Len); to int8_t CDC_Receive_FS (uint8_t Buf, uint32_t *Len)

and add usb_out(); to main loop

@stavinsky
stavinsky / rtc.c
Created June 15, 2017 09:48
ds1302 stm32 hal
/*
* rtc.c
*
* Created on: 11 июн. 2017 г.
* Author: stavinsky
*/
#include "rtc.h"
@stavinsky
stavinsky / README.MD
Created June 15, 2017 09:44
s6d1121 stm32 hal opensmart

This is a test for my lcd display.

PINS DB7:0 connected to A7:0

Other pins connected as described in lcd.h

@stavinsky
stavinsky / 0_reuse_code.js
Created March 28, 2017 18:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@stavinsky
stavinsky / install.sh
Last active March 22, 2017 06:51
amazon os install scrapy and psycopg
yum install python35 python35-pip python35-devel
yum install gcc libxml2-devel.x86_64 libffi-devel libffi-devel libxslt-devel openssl-devel
python3 -m pip install scrapy
yum install postgresql95-devel.x86_64
pip-3.5 install psycopg2
locate bin/scrapy
@stavinsky
stavinsky / utils.py
Created January 23, 2017 16:36
Python sklearn pipline helpers
from sklearn.base import TransformerMixin
class TransformWrapper(TransformerMixin):
"""simple wrapper for instruments like LabelEncoder.
It is usefull if we want to encode many features at one time.
They have a little bit different interface compairing to OneHotEncoder for example"""
def __init__(self, enc):
self.enc = enc
@stavinsky
stavinsky / sulution.erl
Created August 27, 2016 09:52
Hackerrank erlang input and print list example
-module(solution).
-export([main/0]).
input(row) ->
input([], row);
input(column) ->
input([], column).
input(List, row)->
case io:get_line("") of
eof -> List;
@stavinsky
stavinsky / mysql_test_connection.py
Last active January 26, 2016 14:19
simple script to check if mysql drops connections
#!/usr/bin/env python
""" mysql_test_connection.py: simple script to check if mysql drops connections
"""
import mysql.connector
from mysql.connector import errorcode
import sys
import logging
import time
TIMEOUT = 100.0 / 1000 # milliseconds
@stavinsky
stavinsky / build.sh
Last active August 29, 2015 14:27
os x mingw64 32 OS X mingw crosscompile toolchain
#!/bin/bash -e
######
# here last version of all package.
# Please change constants at the top of this file before use!!!
#
# usage: sh -e build.sh all # to build all in a right sequence
#
#
######