Skip to content

Instantly share code, notes, and snippets.

View denysbutenko's full-sized avatar

Denys Butenko denysbutenko

View GitHub Profile
@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 / 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 / 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 / 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);
<?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
// 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
#!/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`
##############
#!/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
@denysbutenko
denysbutenko / private.xml
Created July 25, 2014 15:14
Caps Lock config for Karabiner.
<?xml version="1.0"?>
<root>
<item>
<name>Caps Lock становится F19</name>
<appendix>F19 работает как Shift+Ctrl+Cmd+Opt+Space. Просто F19 работает как клавиша Esc.</appendix>
<identifier>private.f192f19_escape</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::SPACE,