Skip to content

Instantly share code, notes, and snippets.

View nskeip's full-sized avatar
🕶️

Nikita Hismatov nskeip

🕶️
View GitHub Profile
@nskeip
nskeip / parse_target2.py
Created September 21, 2012 10:51
Another way of parsing: what if we have some 'types' of entrieS? We look for type_field_EVENT (or for field_EVENT).
class ParseTarget(object):
TYPES = frozenset(('tire', 'disc', 'oil', 'acc', 'additional',))
def __init__(self):
self.current_tag = None
self.current_type = None
self._depth = 0
# https://rvm.io/packages/openssl/ - look
sudo apt-get install openssl # do i need this?
rvm pkg install openssl
rvm reinstall all --force
sudo apt-get install libsqlite3-dev
gem install sqlite3 -v '1.3.7'
@nskeip
nskeip / .vimrc
Created May 30, 2013 05:39
a nice day to post my .vimrc
filetype off
call pathogen#runtime_append_all_bundles()
" making CommandT work...
map <C-t> :CommandT<CR>
syntax enable
set background=light
set t_Co=16
let g:solarized_termcolors=16
colorscheme solarized
@nskeip
nskeip / hrefs.pl
Created August 4, 2013 06:46
Shows all the links from stdin
#!/usr/bin/perl
#
$text = <>;
@links = $text =~ m/href=\"([^\"]+)/g;
print join ("\n", @links), "\n";
@nskeip
nskeip / multiple_csv.R
Created June 12, 2014 12:18
Read multiple CSV files into a single dataframe
create_big_data_from_csv_dir <- function(directory, ids) {
# locate the files
files <- list.files(directory, full.names=T)[ids]
# read the files into a list of data.frames
data.list <- lapply(files, read.csv)
# concatenate into one big data.frame
data.cat <- do.call(rbind, data.list)
fibonacci :: Integer -> Integer
fibonacci 0 = 0
fibonacci 1 = 1
fibonacci n = fibohelper n 1 0
fibohelper 1 acc1 acc2 = acc1
fibohelper c acc1 acc2 = fibohelper (c - 1) (acc1 + acc2) acc1
@nskeip
nskeip / Moving.hs
Last active June 21, 2017 19:50
Moving.hs
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances, FlexibleContexts #-}
import Geom2D
left :: (Num a) => Point a -> a -> Point a
left (Point x y) n = Point (x - n) y
right :: (Num a) => Point a -> a -> Point a
right (Point x y) n = Point (x + n) y
up :: (Num a) => Point a -> a -> Point a
@nskeip
nskeip / ParseForm.hs
Last active July 9, 2017 08:30
Parsing forms suggestion for Dashdo project
{-# LANGUAGE OverloadedStrings, ExistentialQuantification, ExtendedDefaultRules, FlexibleContexts, Rank2Types, TemplateHaskell #-}
module Demo where
import Data.Monoid ((<>))
import Lens.Micro.Platform
data ExampleParams = ExampleParams
{ _foo :: Int
, _bar :: [Int]
} deriving (Show)
import re
import sys
import sqlite3
import sqlparse
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QAbstractTableModel, Qt
class SQLite3TableModel(QAbstractTableModel):
def __init__(self, db, queriesText, *argv, **kwargs):