Skip to content

Instantly share code, notes, and snippets.

@aka-z
aka-z / nginx-tuning.md
Created March 31, 2021 01:21 — 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.

@aka-z
aka-z / backup-synology-through-rsnapshot.md
Created December 8, 2020 13:46 — forked from frankkusters/backup-synology-through-rsnapshot.md
Installing and configuring SSH, rsync and rsnapshot to let a LaCie Network Space 2 make backups of a Synology DS215j

Introduction

I need a backup solution for my Synology DS215j NAS. My requirements are:

  • a backup solution that pulls data from the Synology DS, so that it is not possible for malware on the DS to corrupt the backups.
  • a restore solution that is really easy to use for everyone else in my house.
  • highly frequent backups. With modern storage technologies, it's unnecessary to lose more than an hour's worth of work.

Also, I have a LaCie Network Space 2 lying around, which is perfectly up to this task. Let's install and configure rsnapshot*!

@aka-z
aka-z / scrapeImages.py
Created February 11, 2020 16:05 — forked from genekogan/scrapeImages.py
scraping full size images from Google Images
from bs4 import BeautifulSoup
import requests
import re
import urllib2
import os
import argparse
import sys
import json
# adapted from http://stackoverflow.com/questions/20716842/python-download-images-from-google-image-search
@aka-z
aka-z / libwebsockets-webserver.c
Created December 18, 2019 03:53 — forked from martinsik/libwebsockets-webserver.c
Simple webserver based on libwebsockets library. Read full description at http://martinsikora.com/libwebsockets-simple-http-server
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libwebsockets.h>
static int callback_http(struct libwebsocket_context *context,
struct libwebsocket *wsi,
enum libwebsocket_callback_reasons reason, void *user,
<p th:text="${bean.field + '!' + bean.field}">Static content</p>
th:text="'static part' + ${bean.field}"
th:text="${'static part' + bean.field}"
@aka-z
aka-z / -Spring-JPA-Dynamic-Query-With-Limit
Created November 1, 2019 12:12 — forked from tcollins/-Spring-JPA-Dynamic-Query-With-Limit
Spring Data JPA - Limit results when using Specifications without an unnecessary count query being executed
If you use the findAll(Specification, Pageable) method, a count query is first executed and then the
data query is executed if the count returns a value greater than the offset.
For what I was doing I did not need pageable, but simply wanted to limit my results. This is easy
to do with static named queries and methodNameMagicGoodness queries, but from my research (googling
for a few hours) I couldn't find a way to do it with dynamic criteria queries using Specifications.
During my search I found two things that helped me to figure out how to just do it myself.
1.) A stackoverflow question.
@aka-z
aka-z / gist:e9b7b89762de61f790ef06e8b71964ae
Created October 30, 2019 11:04 — forked from MrDys/gist:3512455
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id:
<div class="modal" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
@aka-z
aka-z / ssl-check.py
Created October 5, 2019 13:34 — forked from gdamjan/ssl-check.py
Python script to check on SSL certificates
# -*- encoding: utf-8 -*-
# requires a recent enough python with idna support in socket
# pyopenssl, cryptography and idna
from OpenSSL import SSL
from cryptography import x509
from cryptography.x509.oid import NameOID
import idna
from socket import socket
@aka-z
aka-z / arduino-stomp.ino
Created September 29, 2019 23:52 — forked from krhoyt/arduino-stomp.ino
STOMP Implementation for Arduino Yun
// Libraries
#include <Bridge.h>
#include <YunClient.h>
// Defines
// Used for connectivity parameters
#define ENDPOINT "kaazing.kevinhoyt.com"
#define LOGIN " "
#define PASSCODE " "
#define PORT 61613
@aka-z
aka-z / Spring STOMP chat
Created September 25, 2019 17:42 — forked from theotherian/ Spring STOMP chat
Spring STOMP chat
Spring STOMP chat