Skip to content

Instantly share code, notes, and snippets.

@osya
osya / gist:90b5f43588235bdd6e62
Last active August 29, 2015 14:21
Парсилка кадастровых номеров на Python #Python #cadastral
def torgiGetLandNumber(s):
'''
:param s: строка, содержащая кадастровый номер
:return: возвращает распарсенный кадастровый номер из входной строки
'''
# Делаем рекурсивную замену символов в строке
x2 = clear_cell(s)
x2 = x2.replace('"','').replace('-',':').replace('/',':').replace('\\',':').replace(';',':').replace('.',':').strip()
x2 = (lambda s: (lambda f, *a: f(f, *a)) (lambda rec, s: rec(rec, s.replace('::',':')) if '::' in s else s, s))(x2) # рекурсивно заменяем повторно идущие двоеточия
# Вырезаем из строки все цифры и символы двоеточия
@osya
osya / neural.py
Created May 26, 2015 19:58
Пример векторной реализации нейронной сети с помощью Python tutorial #neural #Python
# Source: https://getpocket.com/a/read/932998243
import copy
import numpy as np
import random as rd
import theano.tensor as th
class network:
# layers -list [5 10 10 5] - 5 input, 2 hidden
@osya
osya / gist:88520e71a701061191bd
Last active August 29, 2015 14:20
Working with DBF (FIAS database) in Python #Python
# -*- coding: utf-8 -*-
#Encoding settings for correct utf-8 parsing
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import timeit
#TODO: сделать то же самое на двух других библиотеках
start_time = timeit.default_timer()
@osya
osya / gist:55c1e6e594dfac9c92ca
Last active November 26, 2015 07:27
Convert ArcGIS DateTime #datetime #CSharp
using System;
namespace Strategis.Server.SpatialProcessor.DataInterop.ArcGis
{
public static class ArcGisDateTimeHelper
{
/**********************************************************************************/
// Declarations
/**********************************************************************************/
@osya
osya / gist:6b8eea074efa24e48df1
Last active August 29, 2015 14:18
Working with JavaScript in SSRS #BI #SSRS #MIS #JavaScript
'''____________________________________________________________
''' Function #3/3 (Main): ver. 1.0
''' <summary>
''' Создает новую с сылку для открытия отчета в новом окне - тег A и JavaScript...open
''' </summary>
''' <param name="LinkName">Название ссылки</param>
''' <param name="ReportServerPath">URL сервера отчетов</param>
''' <param name="ReportFolder">Директория отчета</param>
''' <param name="ReportName">Название отчета</param>
''' <param name="ParamParameters">Все праметры отчета (передается как Parameters)</param>
@osya
osya / gist:cb3d97aa2034278e3385
Last active August 29, 2015 14:18
Working with zipped parameters in .NET & SSRS #BI #MIS #regexp #SSRS
'''============================================================
''' Функции для сжатия и распаковки параметров
'''____________________________________________________________
''' Function #1/4: ver. 1.0
''' <summary>
''' Сжимает строку
''' </summary>
''' <param name="text">Строка которую необходимо сжать</param>
''' <returns>Сжатая строка</returns>
''' <remarks></remarks>
@osya
osya / gist:2a33399e872c545a10a0
Created March 27, 2015 09:48
SQLCMD Example #SQL
sqlcmd -S misdev1 -E -d DWH -i SAT_Territory_Fact.sql -o SAT_Territory_Fact_out.txt
sqlcmd -S misdev1 -E -d DWH -i HUB_Territory.sql -o HUB_Territory_out.txt
sqlcmd -S misdev1 -E -d DWH -i LNK_Territory_Hierarchy.sql -o LNK_Territory_Hierarchy_out.txt
@osya
osya / gist:18ee92aa27197f69bc38
Created March 19, 2015 08:57
Foreign key #SQL
Check If Primary Key exists:
IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'
AND TABLE_NAME = 'SAT_Lands_Open_Source'
AND TABLE_SCHEMA ='rlt')
ALTER TABLE [rlt].[SAT_Lands_Open_Source] DROP CONSTRAINT [PK_Realty_Lands_Open_Source]
SQL server will not let you truncate the table while the constraint exists, even if it's disabled. Drop the constraint and re-create it after truncating the table. Or just drop and re-create the tables, whichever is easier to do in your application.
IF EXISTS (SELECT *
FROM sys.foreign_keys
@osya
osya / gist:05111dce6fc61454db8a
Last active November 26, 2015 07:27
Торговый робот, основанный на пересечении простых скользящих средних #WLD #CSharp
using System;
using System.Collections.Generic;
using System.Text;
using WealthLab;
using WealthLab.Indicators;
using System.Drawing;
namespace WealthLabCompile
{
class MovingAverageCrossover : WealthScript
@osya
osya / gist:725fbde5e12d104a3858
Last active November 26, 2015 07:27
Описание параметров оптимизации стратегии Wealth-Lab в коде #WLD #CSharp
using System;
using System.Collections.Generic;
using System.Text;
using WealthLab;
using WealthLab.Indicators;
using System.Drawing;
namespace WealthLabCompile
{
class MovingAverageCrossover : WealthScript