Skip to content

Instantly share code, notes, and snippets.

View colorwebdesigner's full-sized avatar

Ivan Pro colorwebdesigner

View GitHub Profile
@colorwebdesigner
colorwebdesigner / SecureDownload.php
Created June 8, 2025 19:36
SecureDownload - Protected File Download with Counter for MODX Revolution
<?php
/**
* SecureDownload - Protected File Download with Counter for MODX Revolution
*
* Features:
* 1. Generates secure time-limited download links
* 2. Tracks download counts in a Template Variable
* 3. Automatically resolves file paths from Media Source
* 4. Prevents direct access to files
* 5. Detailed logging for debugging
@colorwebdesigner
colorwebdesigner / pageViewCounter.php
Last active June 8, 2025 07:29
MODx Plugin for Unique page views counter with cookie-based tracking
<?php
/**
* pageViewCounter - Unique page views counter with cookie-based tracking
* by Colorwebdesigner
* based on: https://itchief.ru/modx/page-hit-counter
*
* EVENT: OnLoadWebDocument
*
* CONFIGURATION:
* 1. Create a TV (Template Variable) with name "views_page" (type: Number)
@colorwebdesigner
colorwebdesigner / DEV_LIFE.sh
Last active May 30, 2025 20:13
DEV_LIFE — A Bash Koan. A minimalist pseudo-code parable about every developer’s journey from framework dependence to enlightenment.
function DEV_LIFE() {
while true; do
FRAMEWORK
if [ DEPENDENCIES -gt UNDERSTANDING ]; then
continue
elif [ SOUL -eq FREEDOM ]; then
LINUX && BASH
break
fi
done
@colorwebdesigner
colorwebdesigner / pcinfo.sh
Last active February 24, 2022 22:52
Tested on GNU Linux Debian system. Collect general inormation about PC hardware, generate nice report and print to cli or file.
#!/bin/bash
# pcinfo.sh
# ---
# Collect general inormation about PC hardware,
# generate nice report and print to cli or file
# --------------------------------------------------------
# author : [email protected]
# license : GNU
# date : 17.02.2022
# src : https://gist.github.com/colorwebdesigner/b8cd5225741066c502c2f9435f7ae47a
@colorwebdesigner
colorwebdesigner / modx_update.sh
Last active February 12, 2022 09:56
MODx Revolution advanced update and backup script
#!/bin/bash
# modx_update
#
# MODx Revo advanced update script
# 1) Put this file in your website folder
# 2) Make it executable
# 3) Run
# --------------------------------------------------------
# Script will automaticaly find all configs, core folder
# (even if you change default name and location), make
@colorwebdesigner
colorwebdesigner / system-updater.sh
Last active February 12, 2022 08:56
CLI GUI for linux system update and upgrade
#!/bin/bash
# system-updater
# ---
# CLI GUI for system update and upgrade
# --------------------------------------------------------
# author: Ivan Pro Tools
# github: https://github.com/colorwebdesigner
# date: 17-01-2022
# license: GNU
# --------------------------------------------------------
@colorwebdesigner
colorwebdesigner / translit.sh
Created January 26, 2021 19:51
Bash transliteration script
#!/bin/bash
# translit function
# ----------------------
translit() {
local trs="${1// /-}"
trs=$(sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/" <<< "${trs}")
trs=$(sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/" <<< "$trs")
trs=${trs//ч/ch}
<?
$filter = Array ("xxxxxxx" => "xx");
$rsUsers = CUser::GetList(($by="ID"), ($order="asc"), $filter);
while($rsUsers->NavNext(true, "f_")) :
echo "[".$f_ID."] (".$f_LOGIN.") ".$f_NAME." ".$f_LAST_NAME."<br>";
endwhile;
?>
@colorwebdesigner
colorwebdesigner / btrx-rcpass-restore.php
Created August 19, 2020 11:41
Bitrix backup password restore
/*
--------------------------------------
Restore backup password
start from PHP console in your Bitrix admin
--------------------------------------
*/
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/backup.php");
var_dump(CPasswordStorage::Get('dump_temporary_cache'));
# For root user
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;34m\]@\h:\[\033[;033m\]\w\[\033[00m\] \$ "
# For common user
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[01;34m\]@\h:\[\033[;033m\]\w\[\033[00m\] \$ "