Skip to content

Instantly share code, notes, and snippets.

View vshjxyz's full-sized avatar
🌀

Luca Del Bianco vshjxyz

🌀
View GitHub Profile
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}

Write Performance Benchmark

This document will allow anyone to verify the benchmark result of writing 2 - 3 million metrics per second into DalmatinerDB. This is a single node benchmark to keep things simple and easily comparable between time series databases that don't support clustering.

We will setup 2 Haggar servers to generate metrics and fire them at a single node DalmatinerDB server as per this diagram.

dalmatiner benchmark

You can expect near linear performance results as a DalmatinerDB cluster is horizontally scaled.

@josephabrahams
josephabrahams / circle.yml
Created October 26, 2015 18:57
Use .nvmrc with CircleCI
machine:
post:
- nvm use && nvm alias default $(nvm current)
@mxriverlynn
mxriverlynn / 0.js
Last active September 10, 2018 08:33
recursing a tree structure with ES6 generators
function *doStuff(){
yield 1;
yield 2;
yield *doStuff();
}
var it = doStuff();
var res;
res = it.next();
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@vshjxyz
vshjxyz / Appfog django south migrate.py
Last active December 13, 2015 23:58
This is the content of my __init__.py to perform migrations on appfog I needed this because the django-allauth package need to do some migrations initially to work. The Appfog's lack of post-deploy scripts forced me to create a script that I had to put inside one of the apps in my project django_project/appname/management/__init__.py should make…
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.models.signals import post_syncdb
from south.models import MigrationHistory
import pizzanuvola_teaser.settings as settings
def migration_exists(appname, migrationnumber):
appname = appname.split('.')[-1]
return MigrationHistory.objects.filter(app_name=appname, migration__icontains=migrationnumber).exists()
@mgrouchy
mgrouchy / backends.py
Last active December 13, 2015 18:29
Use Johnny Cache with Memcachier. These Changes are required to make it work on Heroku with Memcachier as johnny-cache uses the Django Pylibmc backend which doesn't support SASL.
"""
This is taken wholesale from JohnnyCache except instead of overriding
_get_memcache_timeout in the Django pylibmc backend, we use the Pylibmc
backend from django_pylibmc which supports SASL
"""
from django_pylibmc.memcached import PyLibMCCache
class JohnnyPyLibMCCache(PyLibMCCache):
"""
@elmarcoh
elmarcoh / table_init.js
Created October 26, 2012 21:35
Using Tastypie as an Ajax Source for DataTables
$('#participantes-table').dataTable({
bProcessing: true,
bServerSIde: true,
sAjaxSource: "/path/to/your/tastypie/api/list/objects/?format=json",
sAjaxDataProp: "objects",
aoColumns: [
// Put the resource name that corresponds to each table column
{'mData': "your"},
{'mData': "columns"},
],
@jonotron
jonotron / backbone.dualstorage.relational.js
Created July 24, 2012 21:43
Recursively create UUIDs on Backbone.RelationalModels when saving via Backbone.Dualstorage
var _create = window.Store.prototype.create; // reference to original create
/**
* Create a slightly more compliant UUID generator
* credit: http://stackoverflow.com/posts/2117523/revisions
*
* @returns generated UUID
*/
var generateId = window.Store.prototype.generateId = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@stringfellow
stringfellow / spine_modelresource.py
Created May 18, 2012 13:19
Spinejs - django-tastypie integration base ModelResource class
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
from tastypie.resources import ModelResource
class SpineFrontedResource(ModelResource):
"""A base model resource for spine-fronted models.
* Bins the 'id' that spine sends.
* Removes 'meta' from the list, returns only objects.