Skip to content

Instantly share code, notes, and snippets.

View lqdc's full-sized avatar

Roman Sinayev lqdc

View GitHub Profile
@lqdc
lqdc / test_ci.py
Created May 10, 2016 04:13
Confidence Intervals for Logistic Regression
# -*- coding: utf-8 -*-
# @Author: roman
# @Date: 2016-05-09 19:59:31
# @Last Modified by: roman
# @Last Modified time: 2016-05-09 21:08:37
import numpy as np
from sklearn.cross_validation import train_test_split
@lqdc
lqdc / jsinject
Created March 6, 2015 00:37
jsinject.js
<script type="text/javascript">
function loadCustomScripts() {
var elems = document.getElementsByTagName('IMG');
console.log(elems);
for (var x = 0; x < elems.length; x++) {
if (elems[x].className.indexOf("JS_EMBED") >= 0) {
var use_source = elems[x].src;
if (/^https?:\/\/[^\/\\]+[.]juniper[.]net\/[^?]+[.]js$/.exec(use_source)) {
var s = document.createElement('SCRIPT');
s.type = "text/javascript";
@lqdc
lqdc / model.py
Last active August 29, 2015 14:08
Mathematical Model of Malware Proliferation
import numpy as np
import pylab as pl
def calc_lv(x, y, coefs):
x_new = x * (coefs['a'] - coefs['b'] * y - coefs['c'])
y_new = y * (coefs['e'] * coefs['b'] * x - coefs['d'])
return x_new, y_new
@lqdc
lqdc / wc.jl
Last active August 29, 2015 13:56
word count comparison
function wordcount(text)
words=split(readall(text), Set([' ','\n','\r','\t','-','.',',',':','_','"',';','!']),false)
counts=Dict()
for w in words
counts[w] = get(counts,w,0)+1
end
return counts
end
tic();open(wordcount, "input1.txt");toc()
@lqdc
lqdc / faster_py.py
Last active August 29, 2015 13:56
Memory Access Microbenchmark
import time
def initTrades(trades):
for i, trade in enumerate(trades):
if i % 2:
trade["side"] = 'S'
else:
trade["side"] = 'B'
trade["tradeId"] = i
trade["clientId"] = 1
@lqdc
lqdc / viterbi.jl
Created April 24, 2013 04:44
Viterbi implementation in Julia Language
# Author: Roman Sinayev
# License: BSD Style.
# Viterbi algorithm implementation and example written in Julia Language
#
# The idea is to decode the most probable order of a hidden markov model
# based on indirect observations.
# In the example below, we attempt to determine where a person is based on
# their cell phone service strength. We also have fake probabilities associated
# with each state(location) and with transitions between locations and with
@lqdc
lqdc / text.py
Created March 29, 2013 09:34
count vectorizer without pickling methods (doesn't work)
# -*- coding: utf-8 -*-
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck <L.J.Buitinck@uva.nl>
# Robert Layton <robertlayton@gmail.com>
# Jochen Wersdörfer <jochen@wersdoerfer.de>
# Roman Sinayev <roman.sinayev@gmail.com>
#
# License: BSD Style.
"""