Skip to content

Instantly share code, notes, and snippets.

View carloscarcamo's full-sized avatar
🏠
Working from home

Carlos Cárcamo carloscarcamo

🏠
Working from home
View GitHub Profile
@carloscarcamo
carloscarcamo / async-await.js
Created February 22, 2018 20:25 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@carloscarcamo
carloscarcamo / docker-cleanup-resources.md
Created September 7, 2017 10:42 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@carloscarcamo
carloscarcamo / rubyvm.patch
Created August 14, 2017 22:41 — forked from coldnebo/rubyvm.patch
fix for compile issue encountered in https://github.com/rvm/rvm/issues/4000
diff --git a/random.c b/random.c
index e669e98..9334921 100644
--- a/random.c
+++ b/random.c
@@ -521,7 +521,7 @@ fill_random_bytes_syscall(void *seed, size_t size, int unused)
CryptGenRandom(prov, size, seed);
return 0;
}
-#elif defined __linux__ && defined SYS_getrandom
+#elif defined __linux__ && defined __NR_getrandom
@carloscarcamo
carloscarcamo / perf-flame-graph-notes.md
Created August 14, 2017 05:18 — 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
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5vTPUMETGvPgvzecgujL+8JBHxVpBFcD3pjlKWlb9Yb2QYHwvB91iTDoV7f1736S1lo+cCZ3Y1Ofu/tlrHC6JvWH9oHeOJ8Gcy5rH41Nb51ntf9fz/Wv1YPhFvMVLvmHFaIha41uqTsYTfbWubkR+zxvaEhLvGZXWUusaHc1a7zchCjAOnyagcfzBurjBVWfKFuAQucschXE/Qt6gg2/0BpVQvMrU9+dLJvIvdYQ9rReh09WZtIdJnjbnzrsl+ekZyGKMirOfTtaC4l0mdZBrIOT6F3e1XZNNQWapkHz05ThyekwGuRAK6PGkYDkCrKs7GDeGaUaCoSWMQQgH0iap luis0man@Luiss-MacBook-Pro-2.local
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDE25JoIYrxEH6cYFs+xeryyEKsKmxPfjJHJnFdsa57vZ2Gj/lRY2B3WuMnH85q/Rd0g6Y+9VL09iQ5XeBST5XqveSFaL7AfherMesmSZrFYRApw3dZTVRbRrl2o0GU9rmx+S0WA9GuupX7srmYt25PH5QQVG09/0niXDdTK8OyjMNFnXNZdc6Xx3hrTmFf9eQ/te2LQyW/9LDvj6LYxJAjLI79ITf2C/UQh39MDrIRqzGvgjaSdROAaFcHS+Z9PLQ5aGgPWRmR0zry/H93Hw82DyH50Lw43+1SjSDJCK3fQ2Dw6iAmYAYc5+aq730J1zAgf8lWomU8EPJ/BopOevYP root@monitoring
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC40dmI/g90DnNg5/+7auEQ1EvzR6WKomoiEOST9Bmcw04x0O+yDQ62h8vGjBl53GYDMcYtWEmj5A904Yt9SH6vwc6I80YMY94yoi6MO292KJVetoIsiBZzBsUdvpEZa/nwtQfrMt5ZCWhXzbRMPrVcooBVyAUWNXc3MA/sdx5I5PY
@carloscarcamo
carloscarcamo / nodejs-custom-es6-errors.md
Created February 1, 2017 06:30 — forked from slavafomin/nodejs-custom-es6-errors.md
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js

@carloscarcamo
carloscarcamo / letsencrypt_2016.md
Created January 17, 2017 04:33 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up mydomain.com to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.

[mysqld]
# opciones para el proceso mysqld:
ndbcluster # Corre el almacenamiento NDB
[mysql_cluster]
# Opciones para los procesos de MySQL Cluster
ndb-connectstring=192.168.0.102 # ubicación del management server
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # número de replicas
DataMemory=80M # cuanta memoria se dedicara para almacenamiento Storage
IndexMemory=18M # Cuanta memoria se dedicara a index storage
# Para DataMemory e IndexMemory,se usaron los valores por
# defecto, porque la BD que usaremos no es muy grande
[tcp default]
# TCP/IP options:
portnumber=2202 # Este es por defecto; sin embargo se puede utilizar