Skip to content

Instantly share code, notes, and snippets.

Avatar
👽

Danila Vershinin dvershinin

👽
View GitHub Profile
@dvershinin
dvershinin / magento.vcl
Last active May 28, 2021
Magento 2 VCL file for Varnish 4.x: supports multiple stores better, allows purging arbitrary URLs https://www.getpagespeed.com/web-apps/magento/varnish-vcl-magento-2
View magento.vcl
vcl 4.0;
import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
backend default {
.host = "localhost";
.port = "8080";
.first_byte_timeout = 600s;
@dvershinin
dvershinin / cache.xml
Last active Jan 16, 2021
Magento Redis Configuration
View cache.xml
<?xml version="1.0"?>
<config>
<global>
<cache>
<backend>Mage_Cache_Backend_Redis</backend>
<backend_options>
<server>/var/run/redis/redis.sock</server> <!-- or absolute path to unix socket -->
<persistent></persistent> <!-- Specify a unique string like "cache-db0" to enable persistent connections. -->
<database>2</database>
<password></password>
@dvershinin
dvershinin / config.xml
Last active Mar 16, 2018
Magento 1 Best Redis Config
View config.xml
<session_save>db</session_save>
<redis_session> <!-- All options seen here are the defaults -->
<host>/var/run/redis/redis.sock</host> <!-- Specify an absolute path if using a unix socket -->
<port>6379</port>
<password></password> <!-- Specify if your Redis server requires authentication -->
<timeout>2.5</timeout> <!-- This is the Redis connection timeout, not the locking timeout -->
<persistent></persistent> <!-- Specify unique string to enable persistent connections. E.g.: sess-db0; bugs with phpredis and php-fpm are known: https://github.com/nicolasff/phpredis/issues/70 -->
<db>1</db> <!-- Redis database number; protection from accidental loss is improved by using a unique DB number for sessions -->
<compression_threshold>2048</compression_threshold> <!-- Known bug with strings over 64k: https://github.com/colinmollenhou
@dvershinin
dvershinin / rpm-build-workflow.md
Created May 21, 2018 — forked from abn/rpm-build-workflow.md
RPM build and hosting workflow using github, travis-ci and copr
View rpm-build-workflow.md

RPM Build Flow

This document details a simple RPM build flow pattern used to build and host RPM artifacts for open source projects. The below is a visual summary of this flow.

In order to achieve this multiple tools and services are used. The services and their purpose in the flow is as listed below.

Service Purpose
GitHub As is the most common use for GitHub, it holds the build source code. In this case we hold only the spec files and related source files. All other sources, including project binaries/sources are retrieved at build time.
@dvershinin
dvershinin / servcheck.sh
Last active May 31, 2020
Basic web server sanity checks
View servcheck.sh
#!/bin/bash
# TODO: chkconfig cpuspeed off
# CSF: SYNFLOOD = "0" # value of "1" will slow down all new connections from any IP address to
# the server if triggered
# integrate SSD existence test
# STATUS: do not update here, moved to internal https://github.com/GetPageSpeed/servcheck
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root or via sudo" 1>&2
@dvershinin
dvershinin / osx-ssh-kickstart.sh
Last active Jan 11, 2019
Best practices setup for SSH client in OS X
View osx-ssh-kickstart.sh
#!/bin/bash
# generates SSH key, if none
# TODO: suggests "good" key comment
# converts to encrypted key, in case existing key is not an encrypted one
# TODO: ensures that ~/.ssh/config defines that keys are added to agent upon (successfull) connection, and keychain is used for storing key password
# optionally, "fixes" Filezilla by auto-loading keys to SSH agent (otherwise only option is to run "ssh-add" manually or connecting to server in SSH first)
if [ ! -f ~/.ssh/config ]; then
cat << EOF > ~/.ssh/config
@dvershinin
dvershinin / check-cache.sh
Last active Oct 29, 2019
Check for disappearing cache
View check-cache.sh
#!/bin/bash
# Run e.g. check-cache.sh https://www.manzara.si/jakne
# Or time ./check-cache.sh https://www.manzara.si/jakne
if [ $# -eq 0 ]
then
echo "Error: Please specify request URL as argument."
exit 1
fi