Skip to content

Instantly share code, notes, and snippets.

View dvershinin's full-sized avatar
🏠
Working from home

Danila Vershinin dvershinin

🏠
Working from home
View GitHub Profile
#!/usr/bin/python3
import subprocess
REALTEK_PRODUCT_ID = "0bda:8153"
UHUBCTL_PATH = "/opt/homebrew/bin/uhubctl"
def log_message(message):
""" Log messages to the system log using logger. """
@dvershinin
dvershinin / check-cache.sh
Last active October 29, 2019 21:09
Check for disappearing cache
#!/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
@dvershinin
dvershinin / osx-ssh-kickstart.sh
Last active January 11, 2019 14:11
Best practices setup for SSH client in OS X
#!/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 / servcheck.sh
Last active February 6, 2023 18:52
Basic web server sanity checks
#!/bin/bash
echo 'We have updated the script. Please use "curl -L https://bit.ly/servchecksh | bash" next time'
curl -L https://bit.ly/servchecksh | bash
@dvershinin
dvershinin / rpm-build-workflow.md
Created May 21, 2018 23:46 — forked from abn/rpm-build-workflow.md
RPM build and hosting workflow using github, travis-ci and copr

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 / config.xml
Last active March 16, 2018 21:28
Magento 1 Best Redis Config
<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 / cache.xml
Last active January 16, 2021 23:07
Magento Redis Configuration
<?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 / magento.vcl
Last active August 24, 2022 08:50
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
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;