Skip to content

Instantly share code, notes, and snippets.

View andrey-str's full-sized avatar

Andrey Streltsov andrey-str

View GitHub Profile
@andrey-str
andrey-str / main.cpp
Created September 13, 2018 10:56
Blur QWidget window content(with any 3D on top)
namespace
{
QImage applyEffectToImage(QImage src, QGraphicsEffect *effect)
{
if(src.isNull()) return QImage(); // No need to do anything else
if(!effect) return src; // No need to do anything else
QGraphicsScene scene;
QGraphicsPixmapItem item;
item.setPixmap(QPixmap::fromImage(src));
item.setGraphicsEffect(effect);
NetLimiter 4
Registration Name: Vladimir Putin #2
Registration Code: XLEVD-PNASB-6A3BD-Z72GJ-SPAH7
https://www.netlimiter.com/download
# Netlimiter Full Netlimiter Activated Netlimiter cracked Netlimiter Full Version Netlimiter Serial Netlimiter keygen Netlimiter crack Netlimiter 4 serial Netlimiter 4 Crack Netlimiter 4 register Netlimiter 4 patch Netlimiter full Full version Netlimiter 4 Activated Netlimiter 4 Cracked Netlimiter Pro
@andrey-str
andrey-str / common-utils.cpp
Created October 19, 2015 08:49
Reveal file in Finder or Explorer with Qt
void revealFile(QWidget* parent, const QString &pathToReveal) {
// See http://stackoverflow.com/questions/3490336/how-to-reveal-in-finder-or-show-in-explorer-with-qt
// for details
// Mac, Windows support folder or file.
#if defined(Q_OS_WIN)
const QString explorer = Environment::systemEnvironment().searchInPath(QLatin1String("explorer.exe"));
if (explorer.isEmpty()) {
QMessageBox::warning(parent,
@andrey-str
andrey-str / replaceColor.swift
Created April 22, 2016 00:05
Replace color in UIImage with give tolerance value
// color - source color, which is must be replaced
// withColor - target color
// tolerance - value in range from 0 to 1
func replaceColor(color:SKColor, withColor:SKColor, image:UIImage, tolerance:CGFloat) -> UIImage{
// This function expects to get source color(color which is supposed to be replaced)
// and target color in RGBA color space, hence we expect to get 4 color components: r, g, b, a
assert(CGColorGetNumberOfComponents(color.CGColor) == 4 && CGColorGetNumberOfComponents(withColor.CGColor) == 4,
"Must be RGBA colorspace")
//
// Created by Andrey Streltsov on 11/06/15.
// Based on code from here: http://stackoverflow.com/a/28172162/365754
#include "AppRunGuard.h"
#include <qcryptographichash.h>
namespace
{
@andrey-str
andrey-str / setElidedText.cpp
Last active July 9, 2021 05:00
Set "Elided....Text" to QLabel
void setElidedText(QLabel* label, const QString &text){
QFontMetrics metrix(label->font());
int width = label->width() - 2;
QString clippedText = metrix.elidedText(text, Qt::ElideMiddle, width);
label->setText(clippedText);
}
@andrey-str
andrey-str / ufw plexmediaserver app profile.md
Last active December 18, 2020 22:57
Plex Media Server UFW rule
[plexmediaserver]
title=Plex Media Server
description=The Plex Media Server is smart software that makes playing Movies, TV Shows and other media on your computer simple
ports=32400/tcp|1900/udp|32469/udp|5353/udp

Once you have defined your application file, put it in /etc/ufw/applications.d, then tell ufw to reload the application definitions with

ufw app update plexmediaserver
ufw app info plexmediaserver
@andrey-str
andrey-str / gist:03f32aab7a228be353c1f34deb065f23
Last active January 13, 2020 11:22
MySQL шпаргалки (основа взята отсюда: https://habrahabr.ru/post/105954/ )

#Работа с бекапами

NB: пароль в командной строке лучше не указывать, если это не крон-like задача, конечно. Ключ -p запрашивает ввод пароля поссле ввода команды.

Делаем бекап

mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql

###Создаём структуру базы без данных mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql

@andrey-str
andrey-str / convert.sh
Created May 10, 2018 00:11 — forked from akost/convert.sh
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
@andrey-str
andrey-str / gist:297792bff6d131497ee6dc1b789e100d
Created May 8, 2018 21:24 — forked from sparlampe/gist:5b9dc019a62db8a19941f6526e39dff1
OVMF passthrough of RX570 over Thunderbolt3 on Thinkpad P50
prompt:/# kvm -version
QEMU emulator version 2.9.0 (v2.9.0-dirty)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
prompt:/# uname -a
Linux ThinkPad-P50 4.13.8-041308-generic #201710180430 SMP Wed Oct 18 08:33:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux