This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from itertools import chain | |
import csv | |
''' | |
Goal) | |
Create a matrix (csv) that consists of (and is used in an excel file capacity): | |
*** List out each policy (Managed and Inline) that are attached to a user. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
account_id = boto3.resource('iam').CurrentUser().arn.split(':')[4] | |
# Define Argument Parser | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-i', '--iid', required=True, help='instance id') | |
parser.add_argument('-g', '--sgid', required=False, help='security group id') | |
parser.add_argument('-r', '--region', required=False, help='region') | |
parser.add_argument('-b', '--bucket', required=False, help='bucket') | |
parser.add_argument('-t', '--topic', required=False, help='topic') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$eventManager = \Bitrix\Main\EventManager::getInstance(); | |
//--------------------CRM---------------------------------- | |
$eventManager->addEventHandler('crm','OnAfterCrmLeadAdd',function(&$arFields) | |
{ | |
GsResponsibleHistory::Add('LEAD', $arFields['ID'], $arFields['ASSIGNED_BY_ID']); | |
}); | |
$eventManager->addEventHandler('crm','OnBeforeCrmLeadUpdate',function(&$arFields) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
#With DB Query | |
global $DB; | |
$phones = $DB->Query("SELECT * FROM `b_crm_field_multi` WHERE TYPE_ID='PHONE' AND VALUE='".$phone."'"); | |
while($row = $phones->fetch()) | |
{ | |
} | |
$emails = $DB->Query("SELECT * FROM `b_crm_field_multi` WHERE TYPE_ID='EMAIL' AND VALUE='".$email."'"); | |
while($row = $emails->fetch()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define("LOG_FILENAME", $_SERVER["DOCUMENT_ROOT"]."/log.txt"); | |
AddMessage2Log($arMessageFields, "my_module_id"); | |
CModule::IncludeModule('bizproc'); | |
$documentId = CBPVirtualDocument::CreateDocument( | |
0, | |
array( | |
"IBLOCK_ID" => 17, | |
"NAME" => $arMessageFields['SUBJECT'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$ct=new CCrmContact(false); | |
$arParams = array('HAS_PHONE'=>'Y'); | |
$arParams['FM']['PHONE'] = array( | |
'n0' => array( | |
'VALUE_TYPE' => 'WORK', | |
'VALUE' => '12345678', | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$ct=new CCrmContact(false); | |
$arParams = array('HAS_PHONE'=>'Y'); | |
$arParams['FM']['PHONE'] = array( | |
'n0' => array( | |
'VALUE_TYPE' => 'WORK', | |
'VALUE' => '12345678', | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
use Bitrix\Main; | |
Main\EventManager::getInstance()->addEventHandler( | |
'sale', | |
'OnSaleOrderBeforeSaved', | |
'saleOrderBeforeSaved' | |
); | |
function saleOrderBeforeSaved(Main\Event $event) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$arr_file=Array( | |
"name" => $_FILES[IMAGE_ID][name], | |
"size" => $_FILES[IMAGE_ID][size], | |
"tmp_name" => $_FILES[IMAGE_ID][tmp_name], | |
"type" => "", | |
"old_file" => "", | |
"del" => "Y", | |
"MODULE_ID" => "iblock"); | |
$fid = CFile::SaveFile($arr_file, "landings"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_b24_product(key, name, price, file_name, file_url): | |
import requests | |
import base64 | |
image_64_encode = str(base64.b64encode(requests.get(file_url).content))[2:-1] | |
product_data = { | |
"fields" : { | |
"iblockId": 1, |