Skip to content

Instantly share code, notes, and snippets.

View ale10257's full-sized avatar

Alexey Kulagin ale10257

  • Lavrovo Factory
  • Kostroma region
View GitHub Profile
[Unit]
Description=workerman
After=syslog.target
After=network.target
After=redis.service
Requires=redis.service
[Service]
Type=forking
WorkingDirectory=/app/oms/workerman/
<?php
namespace app\components\helpers;
class FirstUpperCase
{
public static function get($string, $encoding = 'UTF-8')
{
@ale10257
ale10257 / SumToCurrencyStrRu.php
Last active July 6, 2019 08:20
Сумма прописью для чека - ru
<?php
/**
* @author https://github.com/adamasantares
*/
namespace app\components\helpers;
class SumToCurrencyStrRu
{
@ale10257
ale10257 / menu.php
Last active August 31, 2020 11:57
Yii2 displaying a menu with an unlimited nesting level from Nested Sets
<?php
/**
* @var $this yii\web\View
* @var $categories \app\models\Category[]
* @var $level_start int
*/
use yii\helpers\Html;
@ale10257
ale10257 / check.sh
Created May 9, 2017 20:21
проверка на чётность bash
#!/bin/bash
D=`date +%j`
USER=$1
if [ $((10#$D % 2)) == 1 ];then
case $USER in
vet)
FILE=user_list_vet
@ale10257
ale10257 / backup_sshfs.sh
Last active May 9, 2017 20:16
backup sites & DB whith sshfs
#!/bin/bash
DATE=`/bin/date '+%d.%m.%Y'`
DB_PASSWD=passwd
PREV_USER=prev_user
cp rsync_email_orig rsync_email
date >> rsync_email
echo "==============================================" >> rsync_email
@ale10257
ale10257 / backup.sh
Last active May 9, 2017 20:17
backup sites & DB
#!/bin/bash
DATE=`/bin/date '+%d.%m.%Y'`
DB_PASSWD=passwd
USERS=$1
cnf=$2
mkdir ~/backup
cp rsync_email_orig rsync_email
@ale10257
ale10257 / create_sites.sh
Last active May 9, 2017 20:17
Create virtual hosts on Apapche2
#!/bin/bash
if (($(id -u) > 0)); then
echo "Вы не рут!!!"
exit 1
fi
echo -e "Введите имя пользователя"
read USER_NAME
ROOT_DIR="/var/www/$USER_NAME/public_html"
@ale10257
ale10257 / create_users.sh
Last active May 9, 2017 20:18
bash script for create users on server
#!/bin/bash
DIR_SITE="public_html/logs"
FILE=create_user
while read USER; do
DIR=/var/www/$USER
useradd -s /bin/bash -md $DIR -c "$USER" $USER
cd $DIR
mkdir -p $DIR_SITE
cp -r /root/.ssh/ ./