Skip to content

Instantly share code, notes, and snippets.

Avatar

Володя vgrish

View GitHub Profile
View addsite.sh
#!/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`
##############
View addplace.sh
#!/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`
##############
View update.sh
#!/bin/bash
echo "Enter username"
read USERNAME
##############
echo "Updating MODx"
cd /var/www/$USERNAME/www/
View remove.sh
#!/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
View xpdomemcachednew.class.php
<?php
/*
* Copyright 2010-2013 by MODX, LLC.
*
* This file is part of xPDO.
*
* xPDO is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
View test.conf
upstream backend-test {server unix:/var/run/php5-test.sock;}
server {
listen 80;
server_name ip;
root /var/www/test/www;
access_log /var/log/nginx/test-access.log;
error_log /var/log/nginx/test-error.log;
index index.php index.html;
rewrite_log on;
View ajax1
<script type="text/javascript" language="JavaScript">
jQuery(function($){
$('#results').load('[[~43]]', {
action: 'field33',
parents: '3',
page: '1',
limit: '10',
//offset: '0'
//where: '{"Data.favorite":"1"}'
});
View infinitescroll
<div class="gallery" id="listsite">
[[!getPageExt@my?
&toPlaceholder=`resList`
&element=`msProducts`
&parents=`3`
&depth=`0`
&includeContent=`1`
&showHidden=`1`
View jquery.infinitescroll.js
/*!
// Infinite Scroll jQuery plugin
// copyright Paul Irish, licensed GPL & MIT
// version 1.5.110124
// home and docs: http://www.infinite-scroll.com
// support for MODX with Ditto
// Usage
// [!Ditto? &parents=`2` &depth=`1` &tpl=`@FILE:assets/templates/site/chunks/article.html` &paginate=`1` &display=`5`!]
View redirect.uri
<?php
$uri = $_SERVER['REDIRECT_URL'];
$ref = $_SERVER['HTTP_REFERER'];
$confirmationFields['uri'] = $uri;
$confirmationFields['ref'] = $ref;
$uri.="\n";
$file=fopen("uri.txt", "a");
fwrite ($file,"http://".$_SERVER['SERVER_NAME'].$uri);
fclose($file);