Skip to content

Instantly share code, notes, and snippets.

Kiss, György kissgyorgy

Block or report user

Report or block kissgyorgy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kissgyorgy
kissgyorgy / plex.conf
Last active Sep 5, 2019
nginx configuration for Plex
View plex.conf
server {
listen 443 ssl http2;
server_name plex.example.com;
location / {
proxy_pass http://127.0.0.1:32400;
include proxy_params;
# This is for proxying websocket connections for the web interface
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@kissgyorgy
kissgyorgy / list_plex_movie_files.py
Last active Aug 23, 2019
List movies from Plex database
View list_plex_movie_files.py
#!/usr/bin/python3
import sqlite3
from urllib.parse import unquote, parse_qs
PLEX_DB = '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db'
conn = sqlite3.connect(PLEX_DB)
res = conn.execute('SELECT hints FROM media_items WHERE library_section_id = 1;')
@kissgyorgy
kissgyorgy / nginx-tuning.md
Created Aug 21, 2018 — forked from denji/nginx-tuning.md
NGINX tuning for best performance
View nginx-tuning.md

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.

@kissgyorgy
kissgyorgy / wsgi.py
Created May 25, 2018 — forked from rbarrois/wsgi.py
Django uWSGI warmup
View wsgi.py
# -*- coding: utf-8 -*-
import io
import os
import sys
import time
import wsgiref.util
import uwsgidecorators
@kissgyorgy
kissgyorgy / integer_copy.py
Last active Feb 21, 2018
Python: CPython integer optimization
View integer_copy.py
>>> import copy
>>> copy.deepcopy(257) is copy.deepcopy(257)
True
>>> a = copy.deepcopy(257)
>>> b = copy.deepcopy(257)
>>> a is b
False
@kissgyorgy
kissgyorgy / sqlite_magic.py
Last active Jan 22, 2018
Python3: load multiple SQLite rows into one NamedTuple object
View sqlite_magic.py
import sqlite3
from typing import namedtuple
class Environment(NamedTuple):
SLACK_CLIENT_ID: str
SLACK_CLIENT_SECRET: str
SECRET_KEY: str
conn = sqlite3.connect('config.db')
conn.row_factory = sqlite3.Row
View parse_cert_pem.go
certPem := result.Data["certificate"]
certString := certPem.(string)
certBytes := []byte(certString)
block, _ := pem.Decode(certBytes)
cert, err := x509.ParseCertificate(block.Bytes)
@kissgyorgy
kissgyorgy / go_version.go
Created Jun 5, 2017
Python vs Go HTTP Request
View go_version.go
func (b *vaultBackend) Version() string {
r := b.client.NewRequest("GET", "/v1/sys/health")
resp, err := b.client.RawRequest(r)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result struct {
Version string
}
@kissgyorgy
kissgyorgy / crypto_lib_matrix.txt
Last active Mar 18, 2017
Pyton Crypto lib matrix
View crypto_lib_matrix.txt
Subdomain Marked OpenSSL OpenSSL Certifi OSCrypto urllib3
expired.badssl.com ❌ ❌ ❌ ❌ ❌
wrong.host.badssl.com ❌ ❌ ❌ ❌ ❌
self-signed.badssl.com ❌ ❌ ❌ ❌ ❌
untrusted-root.badssl.com ❌ ❌ ❌ ❌ ❌
revoked.badssl.com ❌ ✅ ✅ ✅ ✅
incomplete-chain.badssl.com ⚠ ❌ ❌ ✅ ❌
sha256.badssl.com ✅ ✅ ✅ ✅ ✅
1000-sans.badssl.com ✅ ✅ ✅ ✅ ✅
10000-sans.badssl.com ✅ ❌ ❌ ✅ ❌
View pet-snippet.toml
[[snippets]]
description = "OpenSSL kapcsolódás weboldalhoz és letöltés"
command = "echo -n | openssl s_client -connect officecontrol.hu:443"
[[snippets]]
description = "Weboldal certificate-jének érvényességi ideje OpenSSL-el"
command = "echo -n | openssl s_client -connect officecontrol.hu:443 2> /dev/null | openssl x509 -dates -noout"
[[snippets]]
description = "Disalbe Spotlight"
You can’t perform that action at this time.