Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Pro colorwebdesigner

View GitHub Profile
View btrxUserList.php
<?
$filter = Array
( "UF_DEPARTMENT" => "83");
$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 Aug 19, 2020
Bitrix backup password restore
View btrx-rcpass-restore.php
/*
--------------------------------------
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'));
View bashrc-user-prompt
# 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\] \$ "
@colorwebdesigner
colorwebdesigner / issue
Last active Jun 27, 2020
Sample content of `/etc/issue` file for Debian based systems
View issue
============================================================
Welcome to \n.\o server, stranger!
I see that you are trying to log on \l at \t,
so i make note about it in my log file and report my master.
Big brother already watching you.
------------------------------------------------------------
I'm based on Debian GNU/\s \r, so be jentle,
like other \U inside.
============================================================
@colorwebdesigner
colorwebdesigner / http_dowload.sh
Last active Jun 17, 2020
check curl or wget is install and dowload with progress bar
View http_dowload.sh
#!/bin/bash
# ============================
# Found in install.sh from dnote
# https://github.com/dnote/dnote/blob/master/install.sh
# ============================
http_download() {
dest=$1
srcURL=$2
if is_command curl; then
@colorwebdesigner
colorwebdesigner / mikrotik.setNtpServers.sh
Last active Mar 20, 2020
Mikrotik script (.sh only for syntax highlighting)
View mikrotik.setNtpServers.sh
# ==============================
# setNtpServers
# ==============================
# Mikrotik RB951G-2HnD
# RouterOS v6.46.4 (stable)
# ---
# Corrects IP addresses of NTP servers in
# System -> NTP Client (if they have changed),
# resolve IPs by NTP domains and send message
# to Slack.
@colorwebdesigner
colorwebdesigner / mikrotikAutoConfig.rsc
Created Feb 29, 2020
Mikrotik configuration script
View mikrotikAutoConfig.rsc
{
# Encoding must be UTF-8!
#-------------------------------------------------------------------------------
# Set the name of the router and its SSID
:local systemName ""
# Set the password you would like to use when logging on as 'admin'.
:local adminPassword ""
@colorwebdesigner
colorwebdesigner / slackIPChangeInfo.rsc
Last active May 23, 2020
Mikrotik script for send message to Slack on IP change
View slackIPChangeInfo.rsc
:global ipCurrent "$ipCurrent";
{
# Change to your settings
# -----------------------
:local wanInterface "eth1";
:local slackHookUrl "https://hooks.slack.com/services/YOUR/APP/SECRET";
# -----------------------
:local ipNew [/ip address get [find interface=$wanInterface] address];
@colorwebdesigner
colorwebdesigner / catch-arguments.sh
Last active Jul 26, 2019
Catch and processing script arguments
View catch-arguments.sh
# Function to print help message and exit
usage () {
[ ! -z "$1" ] && printf "\n \e[31m[ error ]\e[0m $0: %s\n" "$1" >&2
printf "$USAGE" >&2
exit 2
}
# Catch arguments
for (( i=1; i<=$#; i++ )); do
case "${!i}" in
You can’t perform that action at this time.