Skip to content

Instantly share code, notes, and snippets.

View renankof's full-sized avatar
:octocat:
Focusing

Renan L. Burda renankof

:octocat:
Focusing
View GitHub Profile
@renankof
renankof / nginx-tuning.md
Created September 30, 2021 17:52 — 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.

@renankof
renankof / example.html
Created September 25, 2021 01:47 — forked from steve228uk/example.html
Deeplink Youtube
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
window.onload = function() {
@renankof
renankof / gist:7f0984e151edb1976e568bf28a83375f
Created July 10, 2020 00:19
Fix whitespace in unicode...; Python
line = re.sub(r'[^\x00-\x7F]+',' ', l, flags=re.UNICODE)
@renankof
renankof / config.json
Created June 24, 2020 23:49 — forked from harperreed/config.json
Slack messages from CRON
{
"token":"xxxxxxxxxx",
"subdomain":"subdomain",
"username":"Eventbot",
"text":"<!everyone> here is an important link: <https://modest.com/|modest.com>",
"channel":"#general",
"icon": ":ghost:"
}
@renankof
renankof / axios-401-response-interceptor.js
Created April 11, 2020 20:04 — forked from yajra/axios-401-response-interceptor.js
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
getDistFromBottom() {
const scrollPosition = window.pageYOffset;
const windowSize = window.innerHeight;
const bodyHeight = document.getElementById('deals-page').offsetHeight;
return Math.max(bodyHeight - (scrollPosition + windowSize), 0);
},
scroll() {
window.onscroll = () => {
if (!this.nextPage) return;
@renankof
renankof / teste_intersection.py
Last active January 23, 2019 12:51
Comparativo entre set Intersection e buscas em diferentes representações de dados Python3.
#!/usr/bin/python3
import random
import time
row_count = 10000000
my_list = {random.randint(0, 2000): random.randint(0, 255) for i in range(row_count)}
my_list2 = {random.randint(0, 2000): random.randint(0, 255) for i in range(row_count)}