Skip to content

Instantly share code, notes, and snippets.

Ivan iredun

Block or report user

Report or block iredun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iredun
iredun / example.php
Created Sep 26, 2019
Быстрый экпорт в эксель, собираем массив $arrayData первый массив содержит заголовки таблиц, дальше массивы данных
View example.php
<?
public function actionExportNumbersData()
{
ini_set("memory_limit", "-1");
set_time_limit(0);
$numbers = Numbers::find()->all();
$spreadsheet = new Spreadsheet();
@iredun
iredun / init.php
Created Jul 30, 2019
Убрать вкладку "Реклама" при редактировании элемента инфоблока 1С-Битрикс
View init.php
<?
AddEventHandler('main','OnAdminTabControlBegin','RemoveYandexDirectTab');
function RemoveYandexDirectTab(&$TabControl){
if ($GLOBALS['APPLICATION']->GetCurPage()=='/bitrix/admin/iblock_element_edit.php') {
foreach($TabControl->tabs as $Key => $arTab){
if($arTab['DIV']=='seo_adv_seo_adv') {
unset($TabControl->tabs[$Key]);
}
}
}
@iredun
iredun / dante.md
Last active Jul 17, 2018
Install dante to Ubuntu
View dante.md
wget http://ppa.launchpad.net/dajhorn/dante/ubuntu/pool/main/d/dante/dante-server_1.4.1-1_amd64.deb
sudo apt-get install gdebi-core
sudo gdebi dante-server_1.4.1-1_amd64.deb

/etc/danted.conf

logoutput: stderr

internal: eth0 port = 1080
@iredun
iredun / route.md
Last active Jun 4, 2018
Настройка роута на CentOS 7
View route.md

Настройка роута на CentOS 7

Сначала удаляем NetworkManager

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

Теперь включаем классическую службу сети в CentOS 7

systemctl enable network.service
@iredun
iredun / bk.py
Created Feb 19, 2018
The python script at the start of which copies all the files in the View folder in the "Download" folder to the folder in the format %d_%m_%Y_bk, also moves the previously created folders every week to a folder of the format %d_%m_%Y_week_db
View bk.py
import shutil
import os
import datetime
from winreg import *
with OpenKey(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders') as key:
Downloads = QueryValueEx(key, '{374DE290-123F-4565-9164-39C4925E467B}')[0]
main_folder = Downloads + "\\"
now = datetime.datetime.now()
@iredun
iredun / saveAllSheetstoFiles.vba
Created Jul 13, 2017
Сохраняет все активные листы в разные файлы xls
View saveAllSheetstoFiles.vba
Sub SaveSheets()
Dim s As Worksheet
Dim wb As Workbook
Set wb = ActiveWorkbook
For Each s In wb.Worksheets
s.Copy
ActiveWorkbook.SaveAs Filename:=wb.Path & "\" & s.Name, FileFormat:=xlExcel8
Next
End Sub
@iredun
iredun / sslcurl.php
Created Apr 24, 2017
get ssl page php func
View sslcurl.php
function getSslPage($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
@iredun
iredun / js.js
Created Apr 20, 2017
scrollTo jQuery extend
View js.js
jQuery.fn.extend(
{
scrollTo : function(speed, easing)
{
return this.each(function()
{
var targetOffset = $(this).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
@iredun
iredun / encoder.py
Created Mar 17, 2017
Python скрипт для рекурсивного перевода файлов(можно указать несколько типов файлов) из кодировки CP1251 в UTF8
View encoder.py
import os, codecs
for (dir, _, files) in os.walk("./"):
for f in files:
path = os.path.join(dir, f)
if f.endswith(('php')):
if os.path.exists(path):
data = open(path, "rb").read()
print(path)
if data.startswith(codecs.BOM_UTF8):
continue
You can’t perform that action at this time.