Skip to content

Instantly share code, notes, and snippets.

View adriancbo's full-sized avatar
🎯
Focusing

Adrian Carballo adriancbo

🎯
Focusing
View GitHub Profile
@adriancbo
adriancbo / controller.snippet.js
Created August 17, 2016 16:24 — forked from njcaruso/controller.snippet.js
Custom loopback change-stream to only show stream updates from the logged in user. The intent is to have a `Message` model that contains private messages for users. The current implementation of change-stream while it accepts an options.where clause, it does not use it. See https://github.com/strongloop/angular-live-set/issues/11.
var url = '/api/messages/stream-updates' +
'?access_token=' + LoopBackAuth.accessTokenId;
var src = new EventSource(url);
var changes = createChangeStream(src);
var set;
Message.find({
filter: {
where: {
@adriancbo
adriancbo / install-pcp.sh
Created November 8, 2016 20:09 — forked from johanstenberg92/install-pcp.sh
Install Performance Co-Pilot on Amazon Linux AMI
#!/bin/sh
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
if !(type pcp 2>/dev/null;) then
yum -y install git bison flex gcc-c++ perl-Tk-devel libmicrohttpd-devel
git clone git://git.pcp.io/pcp
@adriancbo
adriancbo / chrome-in-tz.sh
Created April 22, 2017 06:57 — forked from dustinsmith1024/chrome-in-tz.sh
Open a new chrome in specific timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@adriancbo
adriancbo / node-essential-packages.md
Created November 17, 2017 04:02
Node.js Essential Packages

Node.js Essential Packages

Adrian's collection of super useful NPM packages.

Utilities

Async

  • async - Higher-order functions and common patterns for asynchronous code.
@adriancbo
adriancbo / npm-top.md
Created November 17, 2017 07:59 — forked from bcoe/npm-top.md
npm-top.md

npm Users By Downloads (git.io/npm-top)


npm users sorted by the monthly downloads of their modules, for the range Mar 11, 2017 until Apr 11, 2017.

Metrics are calculated using top-npm-users.

# User Downloads
@adriancbo
adriancbo / default.conf
Created July 16, 2018 22:07
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@adriancbo
adriancbo / docker-cleanup-resources.md
Created August 1, 2018 09:06 — 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

@adriancbo
adriancbo / nginx.conf
Created August 1, 2018 10:14 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
#move_uad_plugins.py - python script to remove unlicensed UAD plugin binaries from VST, AU and AAX folders
import os, shutil
#http://stackoverflow.com/a/800201/674745
def get_immediate_subdirectories(a_dir):
return [name for name in os.listdir(a_dir)
if (os.path.isdir(os.path.join(a_dir, name)) and name != 'Mono')]
@adriancbo
adriancbo / async-foreach.js
Created May 20, 2019 02:46 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)