Skip to content

Instantly share code, notes, and snippets.

View denysbutenko's full-sized avatar

Denys Butenko denysbutenko

View GitHub Profile
#!/bin/bash
ROOTPASS=$(cat /root/.passwd)
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
rm -f /etc/nginx/sites-available/$USERNAME.conf
#!/bin/bash
# MySQL root password
ROOTPASS=$(cat /root/.passwd)
TIMEZONE='Europe/Kiev'
MYSQLPASS=`< /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`
##############
#!/bin/bash
# MySQL root password
ROOTPASS=$(cat /root/.passwd)
TIMEZONE='Europe/Kiev'
MYSQLPASS=`< /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`
##############
// extPath . Classes\Controller\AuthentificationController.php
<?php
namespace Butenko\Opauth\Controller;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
class AuthentificationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {}
?>
// ext_tables.php
<?php
/**
* emailObfuscate output modifier for MODx
* Version: 1.0.0
*
* based on ObfuscateEmail plugin 0.9.1 (Apr 15, 2007) by Aloysius Lim.
* released under Public Domain.
* http://modxcms.com/extras/package/?package=322
*
* This modifier searches for all email addresses and "mailto:" strings in the
@denysbutenko
denysbutenko / modx-cache-refresh.php
Created March 9, 2013 19:19
MODX Cache Refresh Script
<?php
$timeStart = microtime(true);
function downloadXML($path){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$path);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
@denysbutenko
denysbutenko / import_users.php
Created March 2, 2013 16:50
[modx revo]import users from csv
<?php
require_once '/absolute_path/config.core.php';
require_once MODX_CORE_PATH.'model/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error','error.modError');
//To get Base Path
$basePath = $modx->config['base_path'];
// Prepare the data
@denysbutenko
denysbutenko / a readme.md
Created February 10, 2013 03:27 — forked from Mark-H/a readme.md
MODX CLI

modCLI

modCLI is a wrapper for the MODX Revolution Processors, allowing you to pretty much do anything from the commandline that you would normally do within the manager.

To use modCLI, simply download the modcli.php file and put it in the MODX_BASE_PATH of your installation. Next open up the console or terminal, and start firing some commands at it.

Syntax

@denysbutenko
denysbutenko / getAllTVs.php
Created February 4, 2013 05:20
getAllTVs
<?php
$pdoFetch = $modx->getService('pdofetch','pdoFetch',$modx->getOption('pdotools.core_path',null,$modx->getOption('core_path').'components/pdotools/').'model/pdotools/',$scriptProperties);
if (!($pdoFetch instanceof pdoFetch)) return '';
$where = array(
'contentid' => $modx->resource->id
);
if (!empty($excludeTVs)) {
$where['mTV.id:NOT IN'] = explode(',',$excludeTVs);
}
if(empty($templateid)){
@denysbutenko
denysbutenko / modx-remove.sh
Created February 3, 2013 19:57
removeplace
#!/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
rm -f /etc/nginx/sites-available/$USERNAME.conf