Skip to content

Instantly share code, notes, and snippets.

View maximishchenko's full-sized avatar

Maxim Ishchenko maximishchenko

View GitHub Profile
@maximishchenko
maximishchenko / nslookup(resolv)_multiple_hosts.sh
Created January 28, 2016 09:00
nslookup(resolv)_multiple_hosts
#!/bin/bash
# Название файла со списком адресов
inputfile="hosts.txt"
# Имя файла для осуществления вывода
outputfile="addresses.txt"
# Очистка файла вывода при необходимости
> ${outputfile}
# Выполнить nslookup для каждой записи из файла со списком адресов
for i in `cat ${inputfile}`; do nslookup $i >> ${outputfile}; done
# Из файла вывода показать в stdout только строки, содержащие слова "Name" и "Address", т.е. DNS-server, FQDN, IP-address
@maximishchenko
maximishchenko / Create_VPN_Connection_in_Windows_10.ps1
Created November 9, 2015 10:08
Create VPN Connection in Windows 10 (PowerShell)
add-vpnconnection -name "<Name_of_VPN_connection>" -serveraddress "<hostname_or_ip_address>" -splittunneling -tunneltype "l2tp"
# Where:
# splittunneling - use Gateway at Remote Network
# tunneltype - type of VPN-connection (pptp or l2tp)
@maximishchenko
maximishchenko / MSSQL2008_update_part_of_column_value_by_mask
Created October 21, 2015 10:59
MS SQL 2008 update part of column value by mask
/******
UPDATE [db_name].[db_prefix].[table_name] SET column_name = REPLACE(column_name, 'Old_Field_Part', 'New_Field_Part');
Example:
******/
UPDATE [test].[dbo].[VRD_CarSaleContractFilePathNew] SET VRD_ContractFilePath = REPLACE(VRD_ContractFilePath, 'C:\VERDI\Договоры по сделкам\', '\\verdi.ru00185v01.vw-group.ru\Verdi\Договоры по сделкам\');
@maximishchenko
maximishchenko / MS_SQL_2008_backup_table_into_another_new_table.sql
Created October 21, 2015 10:58
MS SQL 2008 backup table into another new table
/******
SELECT * INTO [db_name].[db_prefix].[new_table_name] FROM [db_name].[db_prefix].[old_table_name]
Example:
******/
SELECT * INTO [test].[dbo].[VRD_CarSaleContractFilePathNew] FROM [test].[dbo].[VRD_CarSaleContractFilePath]
@maximishchenko
maximishchenko / Install_Yii2_create_application
Created October 1, 2015 10:46
Install Yii2 into Linux-server and create an application
# SSH-session
# Install Composer to /bin directory
php -r "readfile('https://getcomposer.org/installer');" | php -- --filename=composer --install-dir=/bin
# Install composer plugin to work with Bower
composer global require "fxp/composer-asset-plugin:~1.0.0"
// Go to www-folder
cd /www-folder
@maximishchenko
maximishchenko / Yii_link_to_div.php
Created September 20, 2015 08:50
Yii link to div (custom place on page)
@maximishchenko
maximishchenko / Yii_ajax_loading_example.php
Created September 18, 2015 12:00
Yii add ajax loading indicator
<?php
$this->widget('bootstrap.widgets.TbButton', array(
'label'=>'<ButtonName>',
'type'=>'ButtonType',
'buttonType'=>'ajaxButton',
'encodeLabel'=>true,
'url'=>Yii::app()->createUrl('/<module>/<controller>/<action>'),
'ajaxOptions'=>array(
// Method - POST (for $_POST requests) or GET (for $_GET requests)
@maximishchenko
maximishchenko / Yii_multiple_delete_with_delete_files.php
Last active September 18, 2015 10:04
Yii Multiple Delete Records with delete files
<?php
// There and next:
// ids - the id's of GridView's checkbox column
// <grid-id> - the id's of GridView
// View code
$this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Удалить',
'type'=>'danger',
@maximishchenko
maximishchenko / Yii_delete_link_like_Bootstrap_button.php
Created September 17, 2015 22:52
Yii delete link like Bootstrap Button
@maximishchenko
maximishchenko / Yii_link_inside_GridView.php
Created September 17, 2015 21:18
Yii link inside GridView