Skip to content

Instantly share code, notes, and snippets.

View valentinvichnal's full-sized avatar

Valentin Vichnal valentinvichnal

View GitHub Profile

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote

# To enable rate limiting simply add the following line to the top-level of your config file:
# 1 request / second
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
# Then apply it to a location by adding a rate limiting burst to your server block:
location /account/login/ {
# apply rate limiting
limit_req zone=login burst=5;
@valentinvichnal
valentinvichnal / nginx_common.conf
Created June 30, 2017 18:42 — forked from igortik/nginx_common.conf
Nginx example with DDoS mitigation example (503 error trick)
server {
# ...
# files starting with .dot
#
location ~ /\. {
deny all;
@valentinvichnal
valentinvichnal / ddos_attackers.sh
Created June 30, 2017 18:42 — forked from tiagofernandez/ddos_attackers.sh
Attempts to block DDoS attacks
#! /bin/bash
SEARCHED=$1
if [ -z $SEARCHED ]; then
SEARCHED=/api/flights/fares
fi
echo "Protecting $SEARCHED"
echo "Reading:"
@valentinvichnal
valentinvichnal / nginx.conf
Created June 30, 2017 18:42 — forked from igortik/nginx.conf
Nginx optimized configuration with DDoS mitigation
user nginx;
# one(1) worker or equal the number of _real_ cpu cores. 4=4 core cpu
worker_processes 4;
# renice workers to reduce priority compared to system processes for
# machine health. worst case nginx will get ~25% system resources at nice=15
worker_priority -5;
@valentinvichnal
valentinvichnal / rAF.js
Created November 19, 2016 23:51 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@valentinvichnal
valentinvichnal / Article.md
Created November 19, 2016 22:58 — forked from Warry/Article.md
How to make faster scroll effects?

How to make faster scroll effects?

  • Avoid too many reflows (the browser to recalculate everything)
  • Use advanced CSS3 for graphic card rendering
  • Precalculate sizes and positions

Beware of reflows

The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:

@valentinvichnal
valentinvichnal / run.benchmark.bash
Created November 13, 2016 11:20 — forked from tmcallaghan/run.benchmark.bash
How to benchmark MongoDB
#!/bin/bash
# remember the directory we are starting from
# the script expects the MongoDB configuration files here
export homeDirectory=$PWD
# directory where MongoDB/TokuMX tarballs are located
export tarDirectory=/home/tcallaghan/big-dir/backups/mongodb
# directory used for MongoDB server binaries and data folder
@valentinvichnal
valentinvichnal / methodContainer.js
Created October 31, 2016 14:44 — forked from theodorDiaconu/methodContainer.js
React Meteor Method Container
import React from 'react';
/**
* Method container for React. Very helpful to avoid boilerplate code.
*
* export default methodContainer((props) => { method, param }, Component)
* Will send {error, data, ready} as props to the specified Component
*
* On behalf of www.drivindu.com
*
@valentinvichnal
valentinvichnal / responsive-voice.js
Created October 30, 2016 16:09 — forked from anchetaWern/responsive-voice.js
responsive-voice.js
//Look for other responsivevoice instances
/*if (window.parent != null) {
var iframes = window.parent.document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
//iframes[i].style.width = "300px"
}
}*/
if (typeof responsiveVoice != 'undefined') {
console.log('ResponsiveVoice already loaded');