Skip to content

Instantly share code, notes, and snippets.

Denis Denisov denji

  • Kyiv, UA
View GitHub Profile
View mysql-performance-tuning.sql
-- Query the database to calculate a recommended innodb_buffer_pool_size
-- and get the currently configured value
-- The rollup as the bottom row gives the total for all DBs on the server, where each other row is recommendations per DB.
SELECT
TABLE_SCHEMA,
CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size,
(
SELECT CONCAT(CEILING(variable_value/POWER(1024,FLOOR(LOG(variable_value)/LOG(1024)))),SUBSTR(' KMGT',FLOOR(LOG(variable_value)/LOG(1024))+1,1))
@denji
denji / colorfilters.txt
Created Feb 28, 2019
Wireshark troubleshooting colorfilters
View colorfilters.txt
@T-Small Window Sizes (<1320)@tcp.window_size < 1320 && tcp.window_size > 0@[65535,42405,0][0,0,0]
@T-Large Time Delay (>2 seconds)@frame.time_delta_displayed > 2.0@[65535,42405,0][0,0,0]
@T-DNS Error Responses@!dns.flags.rcode == 0 && dns.flags.response == 1@[42662,29041,4112][0,0,0]
@T-HTTP Error Response (>399)@http.response.code > 399@[65535,42405,0][0,0,0]
!@N-Window Update@expert.message == "Window update"@[0,25700,0][65535,65535,65535]
@I-SYN Packet@tcp.flags.syn == 1@[51657,2313,2313][65535,65535,65535]
@N-TCP Header > 20@tcp.hdr_len > 20@[0,25700,0][65535,65535,65535]
@denji
denji / NGINX-HTTP-Request-Stages.md
Last active Feb 21, 2019
NGINX HTTP Request Stages
View NGINX-HTTP-Request-Stages.md

NGINX actual HTTP Request processing flow is divided into 11 stages.

The reason for this division is to perform logical subdivision request to the module as a processing unit, the various stages can contain any number of HTTP modules and pipelined manner request.

The advantage of this is to make the process more flexible, reducing the degree of coupling.

These 11 HTTP stages are as follows:

  1. NGX_HTTP_POST_READ_PHASE ― The phase of the read request;
@denji
denji / resize-qemu-img
Created Dec 22, 2018 — forked from mortn/resize-qemu-img
online resize qemu image
View resize-qemu-img
F=/var/lib/libvirt/images/ubuntu.img
sudo qemu-img resize $F 50G
sudo virsh blockresize --path $F --size $(qemu-img info $F|sed -n '/virtual size/ s/^.*: //;s/(.*//p') <domain-id>
@denji
denji / 50-org.libvirt.unix.manage.conf
Last active Jan 23, 2019
Allow access to anyone in the libvirt group to run virt-manager without sudo. Tested on Ubuntu 18.04. #Polkit #PolicyKit #pkaction
View 50-org.libvirt.unix.manage.conf
# Ubuntu/Debian
# New rules files are written in JavaScript unsupported. (need pkaction 0.106+)
# /etc/polkit-1/localauthority/50-local.d/libvirt-manage.pkla
[libvirt Management Access]
Identity=unix-group:libvirt
Action=org.libvirt.unix.manage
ResultActive=yes
ResultInactive=yes
ResultAny=yes
@denji
denji / deviceOrientationForGTM.js
Created Aug 26, 2018 — forked from simondahla/deviceOrientationForGTM.js
Device Orientation Detection for Google Analytics. Modded version for Google Tag Manager (GTM). Originally from https://www.themarketingtechnologist.co/using-html5s-device-orientation-to-track-device-behaviour/
View deviceOrientationForGTM.js
/**
* isMobile.js v0.4.0
*
* A simple library to detect Apple phones and tablets,
* Android phones and tablets, other mobile devices (like blackberry, mini-opera and windows phone),
* and any kind of seven inch device, via user agent sniffing.
*
* @author: Kai Mallea (kmallea@gmail.com)
*
* @license: http://creativecommons.org/publicdomain/zero/1.0/
View optimizely-gtm-custom-integration.js
(function() {
var d = false;
window.optimizely = window.optimizely || [];
var o = window.optimizely;
if (o.activeExperiments && o.allExperiments) {
for (var i = 0; i < o.activeExperiments.length; i++) {
var experimentId = o.data.state.activeExperiments[i];
var experimentName = experimentId;
View insert-css-to-head-for-google-optimize.js
/**
* Function adds style element to the bottom of the head element of the page
* @param {string} code Any string of css code
* @return {undefined}
*/
function insertCssToHead( code ) {
var style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
@denji
denji / logTimes.js
Created Aug 26, 2018 — forked from simondahla/logTimes.js
#googleanalytics
View logTimes.js
function logTimes(message) {
if (window.performance) {
performance.mark(message); // this one is for WebPageTest
console.timeStamp(message); // this is for the Performance tab in Chrome DevTools
console.info(message, performance.now()); // this is for the console, duh
// this here is for Google Analytics
ga('send', {
hitType: 'timing',
timingCategory: 'Performance',
You can’t perform that action at this time.