Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
###################################
# Usage: sudo ./installer.sh [os] #
###################################
OS=$1;
UBUNTU="ubuntu";
#############
@dopsmain
dopsmain / button.blade.php
Created June 23, 2016 12:52 — forked from mydnic/button.blade.php
Simple Like System in Laravel 5
<div ng-app="Actions">
<span ng-controller="LikeController">
@if ($post->user->id != Auth::id())
<button class="btn btn-default like btn-login" ng-click="like()">
<i class="fa fa-heart"></i>
<span>@{{ like_btn_text }}</span>
</button>
@endif
</span>
</div>
@dopsmain
dopsmain / function.phpthumb.php
Created April 1, 2016 05:29
phpthumb for smarty
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*
* Smarty {phpthumb} function plugin
*
* Type: function<br>
<?php
$page = preg_match("/p=/", $_SERVER['REQUEST_URI']);
if($page === 1){
return '<meta name="robots" content="index, follow"/>';
}
?>
<?php
/*
* MODX модификатор для транслитерации полей на основе модуля translit [[+page:mod_trans]]
*/
require_once(MODX_CORE_PATH . 'components/translit/model/modx/translit/modtransliterate.class.php');
$trans = new modTransliterate;
$arr = array('\r\n',' ','-','0','x0B','\t','\n','\r','\f','\a','&','=','+','%','#','(',')','«','»','„','“',',',';','№','$','’','*','<','>','~',':','`','@','?','!','[',']','{','}','|','^');
$clean = str_replace($arr, '', $input);
return $trans->translate($clean, 'russian');
@dopsmain
dopsmain / remove.sh
Created March 16, 2016 06:40
Ubuntu 10.04 (nginx + php5-fpm): remove site including user & database
#!/bin/bash
ROOTPASS='password'
echo "Enter username to delete:"
read USERNAME
mysql -uroot --password=$ROOTPASS -e "DROP USER $USERNAME@localhost"
mysql -uroot --password=$ROOTPASS -e "DROP DATABASE $USERNAME"
rm -f /etc/nginx/sites-enabled/$USERNAME.conf
@dopsmain
dopsmain / update.sh
Created March 16, 2016 06:40
Ubuntu 10.04 (nginx + php5-fpm): Update MODx 2.2
#!/bin/bash
echo "Enter username"
read USERNAME
##############
echo "Updating MODx"
cd /var/www/$USERNAME/www/
@dopsmain
dopsmain / addsite.sh
Created March 16, 2016 06:40
Ubuntu 10.04 (nginx + php5-fpm): Install MODX 2.2 including user, virtual host, database
#!/bin/bash
# MySQL root password
ROOTPASS='password'
TIMEZONE='Europe/Moscow'
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
##############
@dopsmain
dopsmain / addplace.sh
Created March 16, 2016 06:40
Script for add non MODX site
#!/bin/bash
# MySQL root password
ROOTPASS='password'
TIMEZONE='Europe/Moscow'
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
##############
@dopsmain
dopsmain / gist:b807a3b502fa105d744d
Created December 30, 2015 06:44 — forked from pepebe/gist:2880482
MODx: snippet2placeholder
<?php
/*
snippet2placeholder
by Bruno17
http://www.modxcms.de/forum/comments.php?DiscussionID=5524#Item_4
Create placeholder from a snippet, for example wayfinder
[[snippet2placeholder?
&snippet=`Wayfinder`
&startId=`1`