Skip to content

Instantly share code, notes, and snippets.

View maximishchenko's full-sized avatar

Maxim Ishchenko maximishchenko

  • Russia
View GitHub Profile
@maximishchenko
maximishchenko / bash_motd_generator.sh
Last active April 29, 2022 08:11
Bash Motd Generator Script
#!/bin/bash
#FILE="/home/user/scripts/motd"
FILE="/etc/motd"
INSTDATE=$(date +%F)
HOSTNAME=$(hostname)
OSRELASE=$(cat /etc/*release | head -1)
#OSDETECT="i-have-to-define"
#IPADDRES=$(ifconfig eth0 | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | head -1)
ETHERADD=$(ifconfig |grep -e ^[a-z] |grep -v lo | awk '{ printf $1 FS}')
@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 / YoutubeThumbs.php
Created May 8, 2017 21:52
Download Youtube Thumbnail
<?php
/**
* Get Preview Image from Youtube video link (not from embeded code) and download it if video exist
* @author Maxim Ishchenko <maxim.ishchenko@gmail.com>
* @version 1.0*
* @uses
*
* $getThumbs = new YoutubeThumbs('https://youtu.be/xxxxxxxxxxx', 'quality', 'directory');
* echo '<img src="'.$getThumbs->getThumbnail().'"/>';
@maximishchenko
maximishchenko / php_GDImageFill.php
Last active July 9, 2017 13:48
PHP Fill or Fit Image (based on gd library)
<?php
namespace common\widgets;
/**
* Crop fill or fit image with php-gd library
* @author Maxim Ishchenko <maxim.ishchenko@gmail.com>
* @version 1.0*
* @uses, @example
* @license GPL
@maximishchenko
maximishchenko / StringOperations.php
Created June 25, 2017 11:53
String Operatons Class
<?php
/**
*
*/
class StringOperations
{
public function Transliterate($str) {
$translit=array(
"А"=>"a","Б"=>"b","В"=>"v","Г"=>"g","Д"=>"d","Е"=>"e","Ё"=>"e","Ж"=>"zh","З"=>"z","И"=>"i","Й"=>"y","К"=>"k","Л"=>"l","М"=>"m","Н"=>"n","О"=>"o","П"=>"p","Р"=>"r","С"=>"s","Т"=>"t","У"=>"u","Ф"=>"f","Х"=>"h","Ц"=>"ts","Ч"=>"ch","Ш"=>"sh","Щ"=>"shch","Ъ"=>"","Ы"=>"y","Ь"=>"","Э"=>"e","Ю"=>"yu","Я"=>"ya",
@maximishchenko
maximishchenko / yii2_proceedGridviewCheckBoxes.js
Created August 17, 2016 12:12
yii2_proceedGridviewCheckBoxes.js
// included script. For example js/gridViewProceedCheckBoxes.js
/**
* [proceedCheckBoxes description]
* @param {[type]} btnID [id of button]
* @param {[type]} gridID [id of GridView]
* @param {[type]} pjaxID [id of pjax-container]
* @param {[type]} emptyAlertText [text for alert "Nothing Checked"]
* @param {[type]} confirmAlertText [text for confirmation alert]
* @param {[type]} proceedURL [controller action ro proceed]
@maximishchenko
maximishchenko / GoogleMaps.php
Last active May 19, 2017 11:16
Download Google Maps Image by Coordinates
<?php
/**
* Get Image from Google Maps API by place coordinates and download it.
* @author Maxim Ishchenko <maxim.ishchenko@gmail.com>
* @version 1.0*
* @uses
*
* $map = new GoogleMaps(
* array(
@maximishchenko
maximishchenko / Windows_remote_shutdown_or_restart.bat
Created March 16, 2016 08:19
Windows remote shutdown/restart
# <arg> - argument (r/s): r - for restart, s - for shutdown
# <time> - time in seconds
# <ws> - ip-address, hostname or fqdn
shutdown -<arg> -f -t <time> -m \\<ws>
@maximishchenko
maximishchenko / Yii2_get_controller_module_and_action_id.php
Created March 6, 2016 20:11
Yii2_get_controller_module_and_action_id
<?php
echo Yii::$app->controller->id;
echo Yii::$app->controller->action->id;
echo Yii::$app->controller->module->id;
@maximishchenko
maximishchenko / Yii2_contact_form_in_footer.php
Last active November 22, 2016 21:57
Yii2 Show Contact Form in Footer