Skip to content

Instantly share code, notes, and snippets.

const express = require('express')
const jwt = require('express-jwt');
const dotenv = require('dotenv');
const constants = require('./constants');
const sandcastle = require('sandcastle');
dotenv.config();
const app = express()
const port = constants.PORT
@dschenkelman
dschenkelman / EventAggregator.js
Created October 8, 2016 02:49
JS event aggregator
import * as Rx from 'rx';
const kSubject = Symbol('subject');
export default class EventAggregator {
constructor(){
this[kSubject] = new Rx.Subject();
}
publish(event, payload){
@dschenkelman
dschenkelman / perf-flame-graph-notes.md
Last active June 20, 2016 21:56 — forked from trevnorris/perf-flame-graph-notes.md
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@dschenkelman
dschenkelman / keybase.md
Created April 7, 2016 13:34
keybase.md

Keybase proof

I hereby claim:

  • I am dschenkelman on github.
  • I am yenkel (https://keybase.io/yenkel) on keybase.
  • I have a public key whose fingerprint is 6955 6E57 3532 5D50 05EE FBF1 75A0 FEFD F7B4 DDAA

To claim this, I am signing this object:

@dschenkelman
dschenkelman / outstart
Created November 24, 2015 18:25
perf script
root@login:/home/vagrant# perf script
# ========
# captured on: Tue Nov 24 10:13:31 2015
# hostname : login
# os release : 3.13.0-57-generic
# perf version : 3.13.11-ckt21
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
@dschenkelman
dschenkelman / sample.md
Created November 4, 2015 18:17
Fighting with mongo's query planner

Index

db.{collection}.ensureIndex({ fieldA: 1, "nested.B": 1, "nested.C": 1 })

Bad query

db.{collection}.find({ fieldA: "abc", "nested.B": "123", "nested.C": "456"})

Only uses first two index fields and then individually scans all matching items for "nested.C": 1.

Good query

db.{collection}.find({ fieldA: "abc", "nested": { $elemMatch: { "B": "123", "C": "456" } })

@dschenkelman
dschenkelman / faketalk.md
Created October 20, 2015 03:47
Fake talk

Rise of microservices

In an era were parallelism is important, it is key to take advantage of multiple processors to leverage our maximum computing power. However, most languages and VMs rely on thread pools and schedulers to manage work and assign work to machine cores, which might lead to either an excessive need for tuning or wasted resources.

In this talk I will explain why JavaScript and in particular it’s server side implementation: node.js can help take advantage of all your resources by providing a scalable infrastructure based on microservices, taking advantage of single thread processes that rely on an event loop. The demos will make use of containerization techiques using Docker to explain how these services can be easily deployed and can communicate in a cloud enviroment.

@dschenkelman
dschenkelman / bad.cs
Created April 6, 2015 20:27
C# foreach tasks
async Task FetchUrls(IEnumerable<string> urls)
foreach (var url in urls){
await fetch(url);
}
}
@dschenkelman
dschenkelman / CustomAuth0Client.cs
Last active August 29, 2015 14:07
Xamarin Auth0Client with support for lang in widget
using System.Reflection;
using Xamarin.Auth;
public class CustomAuth0Client : Auth0.SDK.Auth0Client {
private const string AuthorizeUrl = "https://{0}/authorize?client_id={1}&redirect_uri={2}&response_type=token&connection={3}&scope={4}";
private const string LoginWidgetUrl = "https://{0}/login/?client={1}&redirect_uri={2}&response_type=token&scope={3}";
private readonly string domain;
private readonly string clientId
Perfil,Horario acceso,IP,Accesos inválidos,Clasificación
16,2,1,3,1
2,4,1,3,1
11,4,1,3,1
2,4,1,2,1
30,4,1,3,1
1,4,1,2,1
14,4,1,3,1
8,8,1,3,1
6,8,1,2,1