Skip to content

Instantly share code, notes, and snippets.

@luislobo
luislobo / clone_all_bitbucket.sh
Created Mar 25, 2021
Clones all repositories you have access to in Bitbucket.org (using API 2.0 and workspaces)
View clone_all_bitbucket.sh
#!/bin/bash
cwd=`pwd`
USER=username
PASS=password
SLUG=your_slug # this is the project team name you see in the url
repoUrl=`curl -s --user ${USER}:${PASS} "https://api.bitbucket.org/2.0/workspaces?q=slug=\"${SLUG}\"" | jq -r '.values[] | .links.repositories.href'`
for i in {1..2}; do
View dimQuickfilters.user.js
// ==UserScript==
// @name DIM Quickfilters
// @description Add a quick filter dropdown for DIM
//
// @author jjspace
// @namespace http://github.com/jjspace
// @downloadURL https://gist.github.com/jjspace/b9dec89b1aa68ee9356270b6507bc27c/raw/dimQuickfilters.user.js
//
// @version 1.0.6
// @updateUrl https://gist.github.com/jjspace/b9dec89b1aa68ee9356270b6507bc27c/raw/dimQuickfilters.user.js
@luislobo
luislobo / clone.sh
Created May 25, 2020
Clone one disk to another one in Linux CLI with progress bar
View clone.sh
# replace sdx and sdy with your corresponding disks
dd if=/dev/sdx | pv | dd of=/dev/sdy
@luislobo
luislobo / sails-mongodb-reconnect.md
Created Jun 13, 2019
How to handle MongoDB reconnection on Sails
View sails-mongodb-reconnect.md

First, create a custom configuration with this structure:

   dbStatus: {
    timeoutIncrement: 5 * 1000,
    initialTimeout: 5 * 1000,
    maxTimeout: 60 * 1000,
    dbOnline: true
  }
View install.txt
install.txt ⬡ 8.12.0
apt install build-essential --no-install-recommends
apt install git mc zsh byobu i3 dunst i3lock i3blocks i3status --no-install-recommends
apt install firefox --no-install-recommends
apt install xinit --no-install-recommends
apt install htop --no-install-recommends
# dbus-x11 required by terminator
apt install dbus-x11 terminator --no-install-recommends
apt install feh gsimplecal i3status htop volumeicon-alsa arandr curl keychain ttf-dejavu fonts-font-awesome pavucontrol scrot gnome-calculator gnome-disk-utility gdebi j4-dmenu-desktop \
--no-install-recommends
@luislobo
luislobo / http-to-s3.js
Created Jul 10, 2018
upload from an http resource into s3
View http-to-s3.js
const stream = require('stream');
const request = require('request');
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const BUCKET = 'mybucket';
const KEY = 'luis/yourvideo.mp4';
request.get('https://yoursite/yourvideo.mp4')
.pipe(uploadFromStream())
@luislobo
luislobo / es6-classes-inheritance.js
Created Oct 17, 2017
How to create ES6 static methods that create objects of itself
View es6-classes-inheritance.js
class A {
constructor(name){
this.name = name;
}
static create(name){
return new this(name);
}
@luislobo
luislobo / install_latest_docker_compose.sh
Last active Jun 11, 2021 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
View install_latest_docker_compose.sh
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@luislobo
luislobo / find_lodash.sh
Created Apr 2, 2016
how to find all versions of a package installed inside a node_modules directory
View find_lodash.sh
grep version `find -iname lodash -type d -exec find {} -iname package.json \;`
@luislobo
luislobo / setup-and-teardown-sails-programmatically-for-tests.js If you need also Fixtures, you can add sails-hook-fixtures, and configure it like the following:
View setup-and-teardown-sails-programmatically-for-tests.js
// Require the default sails singleton (this is the same Sails instance you use globally in your app)
var sails = require('sails');
// setup
before(function(done) {
sails.lift({
// You can customize the port if you want (or use sails.load instead if you are testing using the VRI/sails.request() or just need access to the ORM, etc.)
// port: 4000,