Skip to content

Instantly share code, notes, and snippets.

View davalapar's full-sized avatar
🦁
rawr

@davalapar davalapar

🦁
rawr
View GitHub Profile
@davalapar
davalapar / haproxy_websocket_40K_connections_config
Created December 7, 2018 07:04
HAProxy Websocket 40K Connections
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
@davalapar
davalapar / config-haproxy.sh
Created December 7, 2018 07:03 — forked from jsermeno/config-haproxy.sh
Node.js server and Web Sockets on Amazon EC2 with Express.js and Socket.IO - http://catchvar.com/nodejs-server-and-web-sockets-on-amazon-ec2-w
# HAProxy config
mkdir /etc/haproxy
cat > /etc/haproxy/haproxy.cfg << EOF
global
maxconn 4096
defaults
mode http

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@davalapar
davalapar / cookies.js
Created December 4, 2018 20:47
detect coookies
// navigator.cookieEnabled cannot detect custom or nuanced cookie blocking
// configurations. For example, when blocking cookies via the Advanced
// Privacy Settings in IE9, it always returns true. And there have been
// issues in the past with site-specific exceptions.
// Don't rely on it.
// try..catch because some in situations `document.cookie` is exposed but throws a
// SecurityError if you try to access it; e.g. documents created from data URIs
// or in sandboxed iframes (depending on flags/context)
try {
@davalapar
davalapar / notes.md
Created November 9, 2018 05:10
redis-elasticsearch sync
  • upsert / merge (data) is called
    • validate data with schema
    • create transaction
    • set new value
    • add key to 'sync-queue' list : [{key, value}]
    • publish 'trigger-sync' event
    • execute transaction
  • worker event listener receives an 'entity-update' event
    • if current < limit, spawn a 'sync-worker' instance
  • worker executes lua script (STEP A)
@davalapar
davalapar / gist:201c032ac45aa42ee8aef387aa0840ea
Created October 16, 2018 12:38 — forked from mikeyk/gist:1329319
Testing storage of millions of keys in Redis
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@davalapar
davalapar / dump.rdb
Created October 16, 2018 11:57
dump.rdb
https://stackoverflow.com/questions/6004915/how-do-i-move-a-redis-database-from-one-server-to-another
Save a spanshot of the database into a dump.rdb by either running BGSAVE or SAVE from the command line. This will create a file named dump.rdb in the same folder as your redis server. See a list of all server commands.
Copy this dump.rdb to the other redis server you want to migrate to. When redis starts up, it looks for this file to initialize the database from
---
First, create a dump on server A.
@davalapar
davalapar / seo
Created October 16, 2018 09:17
seo
https://support.google.com/webmasters/answer/7451184?hl=en
@davalapar
davalapar / elasticsearch 6.x
Created October 16, 2018 08:31
elasticsearch 6.x
https://rutracker.org/forum/viewtopic.php?t=5588079
@davalapar
davalapar / loadingfonts
Created September 17, 2018 17:15
loadingfonts
https://www.chriscourses.com/blog/loading-fonts-webpack