Skip to content

Instantly share code, notes, and snippets.

doublemarked / !Fragmenting Loopback
Last active May 2, 2016
Boot script for fragmented loading of Loopback models
View !Fragmenting Loopback

Fragmenting Loopback Models

Hey! I've bundled this approach into a component:

This boot script will load module components on app initialization. Stick this file in server/boot. Components are looked for in the directory common/models/model-name. The script will load recursively any script from that directory, passing it the Model handle as a parameter (just like model.js loads). Conveniently, since this is occuring during the boot phase, those model scripts will execute at a later phase than model.js, meaning PersistedModel is already initialized and all peer model handles are already usable. Note - it's necessary for you to still maintain a model.js file for Loopback to load the model at all.

Yimiprod / difference.js
Last active Oct 26, 2020
Deep diff between two object, using lodash
View difference.js
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
keo /
Last active Sep 19, 2020
Setup encrypted partition for Docker containers
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
joshcarr / bookmarklet-boilerplate.js
Last active Aug 29, 2015
bookmarklet boilerplate
View bookmarklet-boilerplate.js
// avoid the bookmarklet activating more than once
if (window.MyNamespace) {
window.MyNamespace = { };
var version = 1,
script = document.createElement('script');
neonexus / OpenSSL
Last active May 17, 2016
AWS ELB OpenSSL commands list
View OpenSSL

Generate KEY and CSR:

openssl req -new -newkey rsa:2048 -nodes -keyout DOMAIN.key -out DOMAIN.csr

Echo the KEY in PEM format:

openssl rsa -in DOMAIN.key -outform PEM

Echo the CRT in PEM format:

carlessistare / tuning_nginx_nodejs
Created Sep 2, 2013
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
View tuning_nginx_nodejs
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
st4lk /
Last active Sep 28, 2020
Python logging settings for root logger
Settings for root logger.
Log messages will be printed to console and also to log file (rotated, with
specified size). All log messages from used libraries will be also handled.
Three approaches for defining logging settings are used:
1. using logging classes directly (py25+, py30+)
2. using fileConfig (py26+, py30+)
3. using dictConfig (py27+, py32+)
Choose any variant as you like, but keep in mind python versions, that
You can’t perform that action at this time.