Skip to content

Instantly share code, notes, and snippets.

View oaleynik's full-sized avatar

Oleh Aleinyk oaleynik

  • CloudSpot
View GitHub Profile

Keybase proof

I hereby claim:

  • I am oaleynik on github.
  • I am oaleynik (https://keybase.io/oaleynik) on keybase.
  • I have a public key ASBrg0DtbBpR75KUp7KSpOlyeyYxhCcTfF55Sm7yzjeg8wo

To claim this, I am signing this object:

function doHash(str, seed) {
var m = 0x5bd1e995;
var r = 24;
var h = seed ^ str.length;
var length = str.length;
var currentIndex = 0;
while (length >= 4) {
var k = UInt32(str, currentIndex);
@oaleynik
oaleynik / java.env
Last active February 12, 2016 08:42 — forked from rosstimson/java.env
Init Script (RHEL, CentOS) for ZooKeeper + optional configs (assumes zookeeper tarball extracted to /opt/zookeeper)
# /opt/zookeeper/conf/java.env
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
ZOO_LOG_DIR="/var/log/zookeeper/"
@oaleynik
oaleynik / ansible_nvm_node_npm_pm2.yml
Last active August 19, 2019 21:48
Run N instances on Amazon EC2, install nvm, node, npm, PM2 and make sure PM2 will be automatically started in the case of the instance reboot
- name: Provision infrastructure
hosts: localhost
gather_facts: False
vars:
keypair: mykeypair
instance_type: m4.large
region: us-west-2
image: ami-f0091d91
/*
The MIT License (MIT)
Copyright (c) 2014
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@oaleynik
oaleynik / build_nginx.sh
Last active December 13, 2015 20:07 — forked from MattWilcox/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2e
export VERSION_NGINX=nginx-1.9.7
# URLs to the source directories
export SOURCE_OPENSSL=https://www.openssl.org/source/
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
@oaleynik
oaleynik / .eslintrc
Created November 30, 2015 00:47 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@oaleynik
oaleynik / fastly.vcl
Created November 10, 2015 09:37 — forked from mdemare/fastly.vcl
C!
# Backends
backend F_addr_api_example_com {
.connect_timeout = 1s;
.dynamic = true;
.port = "443";
.host = "api.example.com";
.first_byte_timeout = 15s;
.max_connections = 200;
@oaleynik
oaleynik / gist:dd481c95c68ed04eaff0
Created November 9, 2015 18:29 — forked from mikhailov/gist:9639593
Nginx S3/Unicorn Proxy with backend keep alive
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@oaleynik
oaleynik / objectToQueryString.js
Last active August 29, 2015 14:27 — forked from dgs700/objectToQueryString.js
Javascript object to URL encoded query string converter. Code extracted from jQuery.param() and boiled down to bare metal js. Should handle deep/nested objects and arrays in the same manner as jQuery's ajax functionality.
var objectToQueryString = function (a) {
var prefix, s, add, name, r20, output;
s = [];
r20 = /%20/g;
add = function (key, value) {
// If value is a function, invoke it and return its value
value = ( typeof value == 'function' ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
if (a instanceof Array) {