Skip to content

Instantly share code, notes, and snippets.

@zv0r
zv0r / gist:50119b5cf0d7edeac9f844fa1d309886
Created May 8, 2019 08:32
Samba 4.10.2 join DC to the domain
INFO 2019-05-08 11:28:02,916 pid:583 /usr/local/samba/lib/python3.5/site-packages/samba/join.py #103: Finding a writeable DC for domain 'corp.company.ru'
INFO 2019-05-08 11:28:02,939 pid:583 /usr/local/samba/lib/python3.5/site-packages/samba/join.py #105: Found DC mskdc.corp.company.ru
Password for [CORP\administrator]:
INFO 2019-05-08 11:28:06,489 pid:583 /usr/local/samba/lib/python3.5/site-packages/samba/join.py #1519: workgroup is CORP
INFO 2019-05-08 11:28:06,490 pid:583 /usr/local/samba/lib/python3.5/site-packages/samba/join.py #1522: realm is corp.company.ru
Adding CN=SPBDC,OU=Domain Controllers,DC=corp,DC=company,DC=ru
Adding CN=SPBDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=corp,DC=company,DC=ru
Adding CN=NTDS Settings,CN=SPBDC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=corp,DC=company,DC=ru
Adding SPNs to CN=SPBDC,OU=Domain Controllers,DC=corp,DC=company,DC=ru
Setting account password for SPBDC$
@zv0r
zv0r / gist:2bb6e12e23b72f065f5c5cc82916dc02
Created May 8, 2019 07:40
ntp, bind9 and samba-ad-dc services status
● ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; generated; vendor preset: enabled)
Active: active (running) since Wed 2019-05-08 10:37:44 MSK; 4s ago
Docs: man:systemd-sysv-generator(8)
Process: 663 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
Process: 673 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)
Tasks: 2 (limit: 36864)
CGroup: /system.slice/ntp.service
└─684 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 108:112
@zv0r
zv0r / gist:0d933e463469bd89702d6fb4847f5f26
Created May 8, 2019 06:59
Samba 4.10.2 provision log
INFO 2019-05-08 09:54:33,910 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2079: Looking up IPv4 addresses
INFO 2019-05-08 09:54:33,910 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2096: Looking up IPv6 addresses
WARNING 2019-05-08 09:54:33,911 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2103: No IPv6 address will be assigned
INFO 2019-05-08 09:54:34,618 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2269: Setting up share.ldb
INFO 2019-05-08 09:54:34,633 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2273: Setting up secrets.ldb
INFO 2019-05-08 09:54:34,646 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2279: Setting up the registry
INFO 2019-05-08 09:54:34,693 pid:27290 /usr/local/samba/lib/python3.5/site-packages/samba/provision/__init__.py #2282: Setting up the privileges database
@zv0r
zv0r / ais-photo-docs-sync.sql
Created April 8, 2016 10:04
Загрузка в АИС заголовков фотодокументов, изначально забиваемых в Excel
SET IDENTITY_INSERT [AISArchive].[dbo].[tblArchiveFiles] ON
/*
*
* ID архивного учреждения, в БД которого заливаются данные
*
*/
DECLARE @ArchId INT
SET @ArchId = 4
@zv0r
zv0r / af_to_site.sql
Created March 15, 2016 13:26
Подготовка справочника фондов для сайта
SELECT
CAST('INSERT INTO fund (isn_fund, isn_archive, isn_doc_type, isn_period, fund_num_2, fund_name_short, fund_name_full, annotate, movement_note, fund_history, doc_start_year, doc_end_year, doc_receipt_year, last_checked_year) VALUES (' + CONVERT(nvarchar(max), (aff.ISN_FUND - 10000000000)) + ', ' + CONVERT(nvarchar(max), (aff.ISN_ARCHIVE - 10000000000)) + ', ' + CONVERT(nvarchar(max), ISNULL(aff.ISN_DOC_TYPE, 1)) + ', ' + CONVERT(nvarchar(max), CAST (CASE WHEN ISNULL(aff.FUND_NUM_1, '') LIKE '' THEN 1 ELSE 2 END as int)) + ', ' + CONVERT(nvarchar(max), ISNULL(aff.FUND_NUM_2, 0)) + ', ''' + CONVERT(nvarchar(max), REPLACE(REPLACE(ISNULL(aff.FUND_NAME_SHORT, ''), '\', '\\'), '''', '\''')) + ''', ''' + CONVERT(nvarchar(max), REPLACE(REPLACE(ISNULL(aff.FUND_NAME_FULL, ''), '\', '\\'), '''', '\''')) + ''', ''' + CONVERT(nvarchar(max), REPLACE(REPLACE(ISNULL(aff.ANNOTATE, ''), '\', '\\'), '''', '\''')) + ''', ''' + CONVERT(nvarchar(max), REPLACE(REPLACE(ISNULL(aff.MOVEMENT_NOTE, ''), '\', '\\'), '''', '\'''))
@zv0r
zv0r / gist:1477bbb0cb3ebd8ce4ff
Created November 27, 2015 06:51
AISCreateKlerDB
-- ID архива, в котором создается тематическая БД
DECLARE @archID INT
SET @archID = 2
-- Имя тематической базы анных
DECLARE @dbName NVARCHAR(2000)
SET @dbName = 'Клировые ведомости'
DECLARE @dbID TABLE(Id INT)
@zv0r
zv0r / gist:f50c30c5990b24dadf05
Created November 27, 2015 06:50
ChurchKlerToAIS
SET IDENTITY_INSERT [AISArchive].[dbo].[tblThemeCards] ON
/*
*
* ID тематической БД клировых ведомостей
*
*/
DECLARE @CatId INT
SET @CatId = 8
@zv0r
zv0r / Inquiry-report-to-upda
Created March 2, 2015 17:33
Отчет по обращениям граждан
SELECT
(SELECT COUNT(*) FROM inquiries2015 inq INNER JOIN v_status st ON st.id = inq.status_id WHERE st.legal = 0 AND inq.reg_date >= '2015-02-01' AND inq.reg_date <= '2015-02-28') AS 'С4', -- всего физлиц
(SELECT COUNT(*) FROM inquiries2015 inq INNER JOIN v_status st ON st.id = inq.status_id WHERE st.legal = 1 AND inq.reg_date >= '2015-02-01' AND inq.reg_date <= '2015-02-28') AS 'D4', -- всего юрлиц
(SELECT COUNT(*) FROM inquiries2015 inq WHERE inq.reg_date >= '2015-02-01' AND inq.reg_date <= '2015-02-28') AS 'E4', -- всего
(SELECT COUNT(*) FROM inquiries2015 inq INNER JOIN v_status st ON st.id = inq.status_id WHERE st.legal = 0 AND (inq.source_id = 1 OR inq.source_id = 6) AND inq.reg_date >= '2015-02-01' AND inq.reg_date <= '2015-02-28') AS 'С5', -- физлиц очно
(SELECT COUNT(*) FROM inquiries2015 inq INNER JOIN v_status st ON st.id = inq.status_id WHERE st.legal = 1 AND (inq.source_id = 1 OR inq.source_id = 6) AND inq.reg_date >= '2015-02-01' AND inq.reg_date <= '2015-02-28') AS 'D5', -- юрлиц очн
@zv0r
zv0r / AISCreateRevizDB
Created January 14, 2014 08:59
Создает в АИС Архив тематическую БД "Ревизские сказки"
-- ID архива, в котором создается тематическая БД
DECLARE @archID INT
SET @archID = 1
-- Имя тематической базы анных
DECLARE @dbName NVARCHAR(2000)
SET @dbName = 'Ревизские сказки'
DECLARE @dbID TABLE(Id INT)
@zv0r
zv0r / AF5toAIS
Last active January 1, 2016 07:29
Переносит записи из АФ5 в АИС Архив
IF EXISTS (
SELECT * FROM sysobjects WHERE id = object_id(N'dbo.getUnitRubric')
AND xtype IN (N'FN', N'IF', N'TF')
)
DROP FUNCTION dbo.getUnitRubric
GO
IF EXISTS (
SELECT * FROM sysobjects WHERE id = object_id(N'dbo.convertDocType')
AND xtype IN (N'FN', N'IF', N'TF')