Skip to content

Instantly share code, notes, and snippets.

View juslintek's full-sized avatar
🎯
Focusing

Linas juslintek

🎯
Focusing
View GitHub Profile
@juslintek
juslintek / setup-taiga-centos-directadmin.sh
Last active September 22, 2016 14:07 — forked from sink66/setup-taiga-centos.sh
Taiga.io minimum install & run commands / CentOS6.8 / Directadmin
#!/bin/bash
echo "Enter your domain:"
read domain
# How to use
# 1. Replace the "YOURIP" to yourIP
# 2. Run at the root -> source setup-taiga-centos.sh
yum install -y gcc autoconf flex bison libjpeg-turbo-devel
@juslintek
juslintek / Trigger Problem
Created November 3, 2016 16:55
OpenQuery in trigger prevents table from working
USE [RC2]
GO
/****** Object: Trigger [dbo].[OpencartProductsUpdate] Script Date: 2016-11-02 01:43:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Linas Jusys
-- Create date: 2016-11-02
@juslintek
juslintek / Seems like FastCGI error
Created November 23, 2016 18:21
This is what I get
2016/11/23 20:05:50 [error] 948#0: *560 FastCGI sent in stderr: "t/Code/100/vendor/laravel/framework/src/Illuminate/Support/helpers.php:33
PHP message: PHP 512. Illuminate\Container\Container->make() /home/vagrant/Code/100/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:462" while reading response header from upstream, client: 192.168.10.1, server: lietuva100, request: "GET /manager/lt/events/items HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "lietuva100"
2016/11/23 20:15:38 [error] 948#0: *562 FastCGI sent in stderr: "PHP message: PHP Fatal error: Maximum function nesting level of '512' reached, aborting! in /home/vagrant/Code/100/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 740
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /home/vagrant/Code/100/index.php:0
PHP message: PHP 2. Illuminate\Foundation\Application->run() /home/vagrant/Code/100/index.php:50
PHP message: PHP 3. Stack\StackedHttpKernel->handle() /home/vagrant
@juslintek
juslintek / gist:85913ff3fc55d8da3cfb750c17913ca3
Created September 16, 2017 08:29
Explain of WP_Queries
mysql> EXPLAIN SELECT COUNT( 1 ) FROM sjwd_posts WHERE post_type = 'page' AND post_status NOT IN ( 'trash','auto-draft','inherit' ) AND post_author = 1;
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------------------+
| 1 | SIMPLE | sjwd_posts | NULL | range | type_status_date,post_author | type_status_date | 164 | NULL | 24 | 36.87 | Using index condition; Using where |
+----+-------------+------------+------------+-------+------------------------------+------------------+---------+------+------+----------+------------------------
@juslintek
juslintek / queries.sql
Last active September 16, 2017 09:16
Queries
SHOW STATUS LIKE 'Qcache%';
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 264909760 |
| Qcache_hits | 3208 |
| Qcache_inserts | 1232 |
| Qcache_lowmem_prunes | 0 |
@juslintek
juslintek / virus_fix.sh
Last active September 19, 2017 19:38
Wordpress Cleaning Script (VestaCP specific)
#!/bin/bash
## You will need pwgen in order for this to work
echo "Enter your webroot directory"
webrootdir=/home/admin/web/
echo "For example where domain names and public html directories are located, like here: $webrootdir: "
read webrootdir;
leftovers=no
echo "Check for leftovers only? (yes/no) - default $leftovers"
@juslintek
juslintek / apache.error.debug.log
Last active September 24, 2017 19:40
Redirect Debug
[Fri Sep 22 18:02:45.661481 2017] [core:error] [pid 20584] [client 172.31.1.119:35672] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661484 2017] [core:debug] [pid 20584] core.c(3628): [client 172.31.1.119:35672] AH00121: r->uri = /wp-admin/media/image1.png, referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661487 2017] [core:debug] [pid 20584] core.c(3635): [client 172.31.1.119:35672] AH00122: redirected from r->uri = /wp-admin/media/image1.png, referer: https://www.replaced-domain.com/wp-admin/post.php?post=7356&action=edit
[Fri Sep 22 18:02:45.661489 2017] [core:debug] [pid 20584] core.c(3635): [client 172.31.1.119:35672] AH00122: redirected from r->uri = /wp-admin/media/image1.png, referer: https:/
@juslintek
juslintek / virus_fix2.sh
Created November 8, 2017 08:56
Wordpress virus fix script on VestaCP
#!/bin/bash
## You will need pwgen in order for this to work
type pwgen > /dev/null 2>&1 || { sudo yum install pwgen; exit 1; }
webrootdir=/home/admin/web/
for domaindir in $(ls $webrootdir);
do
webdir="$webrootdir$domaindir/public_html";
<?php
add_filter( 'the_content', function ( $content ) {
if ( is_single() && get_post_type() == 'post' ) {
$document = new DiDom\Document( $content, false );
$childElements = $document->find( '.entry-content > p' );
$maxElements = $document->count( '.entry-content > p' ) - 1;
if ($maxElements > 3) {
$randomPosition = rand( 3, $maxElements - 2);
} else {
$randomPosition = rand( 0, $maxElements);
-bash-4.1$ magerun sys:modules:list --status=active
Magento Modules
+-----------+------------------------------+----------------+--------+
| codePool | Name | Version | Status |
+-----------+------------------------------+----------------+--------+
| core | Mage_Core | 1.6.0.7 | active |