Skip to content

Instantly share code, notes, and snippets.

@pelligrag
pelligrag / my.cnf
Created February 27, 2022 21:23 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@pelligrag
pelligrag / gist:e1e0384f3da02240a70d2870d00bf4af
Created October 8, 2021 10:25 — forked from dragonfire1119/gist:31914c92087468fb728f23be30cc793b
Step to Auto restart elasticsearch services after crash or down:
1) Edit elasticsearch service unit file using the following command
sudo systemctl edit elasticsearch.service
This command will create a file
/etc/systemd/system/elasticsearch.service.d/override.conf
2) Now, add the following lines in the unit file.
[Service]
Restart=always
@pelligrag
pelligrag / PVE-HP-ssacli-smart-storage-admin.md
Created February 4, 2021 11:17 — forked from mrpeardotnet/PVE-HP-ssacli-smart-storage-admin.md
HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

HP Smart Storage Admin CLI (ssacli) installation and usage on Proxmox PVE (6.x)

Why use HP Smart Storage Admin CLI?

You can use ssacli (smart storage administrator command line interface) tool to manage any of supported HP Smart Array Controllers in your Proxmox host without need to reboot your server to access Smart Storage Administrator in BIOS. That means no host downtime when managing your storage.

CLI is not as convenient as GUI interface provided by BIOS or desktop utilities, but still allows you to fully manage your controller, physical disks and logical drives on the fly with no Proxmox host downtime.

ssacli replaces older hpssacli, but shares the same syntax and adds support for newer servers and controllers.

Installation

@pelligrag
pelligrag / wordpress.vcl
Created July 3, 2020 13:36 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
# A heavily customized VCL to support WordPress
# Some items of note:
# Supports https
# Supports admin cookies for wp-admin
# Caches everything
# Support for custom error html page
vcl 4.0;
import directors;
import std;
@pelligrag
pelligrag / install-google-fonts.sh
Created May 17, 2020 13:58 — forked from keeferrourke/install-google-fonts.sh
A bash script to install all Google Fonts, system wide, on debian based systems (ex. Ubuntu)
#!/bin/sh
# Written by: Keefer Rourke <https://krourke.org>
# Based on AUR package <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-google-fonts-git>
# dependancies: fonts-cantarell, ttf-ubuntu-font-family, git
sudo apt-get install fonts-cantarell ttf-ubuntu-font-family git
srcdir="/tmp/google-fonts"
pkgdir="/usr/share/fonts/truetype/google-fonts"
giturl="git://github.com/google/fonts.git"
@pelligrag
pelligrag / nginx-tuning.md
Created May 15, 2020 20:00 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

sub vcl_recv {
if (req.http.X-Forwarded-Proto !~ "https") {
return (synth(850, "Moved Permanently"));
}
}
sub vcl_synth {
if(resp.status == 850) {
set resp.http.Location = "https://" + req.http.host + req.url;
set resp.status = 301;
#!/usr/bin/perl
use Getopt::Long;
use Switch;
use Net::Statsd;
$Net::Statsd::HOST = 'stats.krn.krone.at'; # Default
$Net::Statsd::PORT = 8125; # Default
%options = (
'help' => 0,
'cache' => 0,
#!/usr/bin/perl
use Getopt::Long;
use Switch;
use Net::Statsd;
$Net::Statsd::HOST = 'stats.krn.krone.at'; # Default
$Net::Statsd::PORT = 8125; # Default
%options = (
'help' => 0,
'cache' => 0,
@pelligrag
pelligrag / cloudflare-failover.sh
Created June 27, 2019 21:10 — forked from Ara4Sh/cloudflare-failover.sh
CloudFlare A records failover script using CloudFlare api v4 (https://api.cloudflare.com) required jq and curl to run.
#!/bin/bash
# Copyright (C) 2016 Arash Shams <https://github.com/Ara4Sh>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of