Skip to content

Instantly share code, notes, and snippets.

SELECT
wp_posts.ID
FROM
wp_posts
LEFT JOIN
wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE
1 = 1 AND wp_posts.ID NOT IN (93110)
AND (wp_term_relationships.term_taxonomy_id IN (8))
AND wp_posts.post_type = 'post'
@sowich
sowich / javascript
Created January 21, 2019 05:57
javascript
"use strict";
fetch("...", {method: "POST"})
.then(result => result.json())
.then(result => {
let ws = new WebSocket("..." + result.connectionId);
ws.onopen = () => {
ws.send(JSON.stringify({...}));
ws.send(JSON.stringify({...}));
@sowich
sowich / danted_install_script.sh
Created June 9, 2018 10:06 — forked from duketwo/danted_install_script.sh
Dante-Server (danted) install script (Debian 8 - Jessie)
# Dante-Server install script (Debian 8 - Jessie)
# Start with 'chmod +x danted_install_script.sh && danted_install_script.sh'
# duketwo - 12.11.2017
random_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
network_adapter=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//")
username="SallySample"
port="31337"
public_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo "Random password: $random_pw"
echo "deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib" >> /etc/apt/sources.list
@sowich
sowich / test.py
Created November 22, 2016 12:16
test.py
# -*- coding: UTF-8 -*-
import threading
import Queue
import os
import datetime
import sys
import time
if __name__ == '__build__':
git archive --format=zip --remote=<$PATH> HEAD > <$NAME_PLUGIN>.zip
@sowich
sowich / wp-query-ref.php
Created July 25, 2016 06:25 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
<?php #ВСТАВИТЬ В ФАЙЛ "archive.php" ?>
<?php if (is_tag()): ?>
<?php foreach (getCatsToTags() as $category) : ?>
<?php $anchor = get_the_category_by_ID($category) ?>
<a href="<?php echo esc_url(get_category_link($category)) ?>" title="<?php echo esc_html($anchor) ?>"><?php echo esc_html($anchor) ?></a>
<?php endforeach; ?>
<?php endif; ?>
<?php #ВСТАВИТЬ В ФАЙЛ "functions.php" ?>
@sowich
sowich / nofollow.php
Last active September 1, 2018 07:56
<?php
add_filter('wp_list_categories', 'esc_wp_rel_nofollow');
add_filter('wp_tag_cloud', 'esc_wp_rel_nofollow');
function esc_wp_rel_nofollow($output)
{
if (is_single() || is_category() || is_tag())
return stripslashes(wp_rel_nofollow($output));
return $output;
@sowich
sowich / unused_tags.php
Last active July 4, 2016 06:14
wordpress отключение служебной инфы
<?php
//........
// отключаем emoji
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
find /PATH -type f -exec chmod 644 {} +