Skip to content

Instantly share code, notes, and snippets.

@n-bar
n-bar / Lesson_1_1.sql
Last active March 19, 2019 08:01
Specialist. SQL Level 2
--1. Задачи на операции с одной таблицей (без джойнов и подзапросов):
--a) В каких категориях имеется несколько товаров от одного и того же поставщика?
SELECT CategoryID
FROM Products
GROUP BY CategoryID, SupplierID
HAVING Count(ProductID) > 1;
--b) Сколько было куплено штук товара, принесшего компании максимальную выручку?
SELECT TOP 1 sum(Quantity) sumQuantity
# https://ru.wikibooks.org/wiki/Реализации_алгоритмов/Расстояние_Левенштейна#Python
def distance(a, b):
"Calculates the Levenshtein distance between a and b."
n, m = len(a), len(b)
if n > m:
# Make sure n <= m, to use O(min(n,m)) space
a, b = b, a
n, m = m, n
current_row = range(n+1) # Keep current and previous row, not entire matrix
@n-bar
n-bar / custom.css
Created July 15, 2016 07:46
Jupyter Theme
/*
Name: Oceans16 Dark (modified to light)
Author: Kyle Dunovan (http://github.com/dunovank)
*/
a {font-family: 'Helvetica', sans-serif; }
div#notebook, div.CodeMirror, div.output_area pre, div.output_wrapper, div.prompt, div.CodeMirror pre {font-family:'Fira Code', monospace; font-size: 11pt;}
/* Hiding the ipython log */
@n-bar
n-bar / try_distance_corr.py
Created July 17, 2016 13:24 — forked from josef-pkt/try_distance_corr.py
distance covariance and correlation
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 14:00:29 2012
Author: Josef Perktold
License: MIT, BSD-3 (for statsmodels)
http://en.wikipedia.org/wiki/Distance_correlation
Yaroslav and Satrajit on sklearn mailing list
@n-bar
n-bar / init.el
Last active October 28, 2018 09:49
.emacs.d/init.el on windows
(server-start)
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__version__ = "0.0.4"
import sys
import argparse
from collections import namedtuple
from multiprocessing.dummy import Pool
@n-bar
n-bar / JXA Resources.md
Created November 22, 2016 20:33 — forked from JMichaelTX/JXA Resources.md
JavaScript for Automation (JXA) Resources

JXA Resources

Revised: 2016-08-29 23:28 CT (Mon)

image

This is a list of the key resources I have found useful. If you know of others, please post in a comment below, and I will add to this list.

I have tried to order this list in the order that, to me, is best for learning JXA from scratch. We all learn a bit diferently, so adjust to suit your style/needs. Please post if you have suggestions on learning JXA.

  • I like starting with the videos in the Introduction.
@n-bar
n-bar / README.md
Last active February 16, 2017 13:46 — forked from jgoodall/README.md
This is a sample of how to send some information to logstash via the TCP input from python.

This is a sample of how to send some information to logstash via the TCP input in python. It assumes the logstash host is on "localhost" and the TCP listening input is 5959.

The logstash.conf should look something like the sample file.

The log message should be a stringified JSON object with the log message in the @message field.

To use, run the python script python sendMessageToLogstash.js

@n-bar
n-bar / server.py
Created February 19, 2017 18:59
HTTPServer Basic Example
"""HTTPServer Basic Example
$ python3 server.py
# HEAD
$ curl -I http://localhost:3000
# GET
$ curl http://localhost:3000/app?id=123
# POST
$ curl http://localhost:3000 -F name=curl_form -F user=n-bar -F [email protected]
"""