Skip to content

Instantly share code, notes, and snippets.

View baamenabar's full-sized avatar
:octocat:
yeah, that

B. Agustín Amenábar Larraín baamenabar

:octocat:
yeah, that
View GitHub Profile
const fileHash = crypto.createHash('md5').update(fileContents).digest('hex');
@baamenabar
baamenabar / stat-is-folder-comparison.js
Created July 11, 2018 20:27
Compare different approaches and node 10.x APIs to stat a directory or folder, and by extension do many fs operations. Includes experiment with fs promises
const fs = require("fs");
const fsPromises = require("fs").promises;
/**
* Util function we will reuse to check if the caught error is simply a "not found" error
*
* @param {*} err
* @returns {boolean}
*/
function isErrorNotFound(err) {
@baamenabar
baamenabar / flyimg-up.sh
Last active January 7, 2019 21:39
Don't forget how to build and start Flyimg in windows 10 home environment with Cmder (conEmu)
# Windows only: Don't forget how to build and start Flyimg in windows 10 home environment with Cmder (conEmu)
# Must have virtualbox installed, ideally through docker toolbox
# do this only once
docker-machine create --driver virtualbox default
# all the subsequent times, only this
docker-machine start default
# hook the virtual env to docker
@baamenabar
baamenabar / install_docker_and_jenkins.sh
Last active December 9, 2021 21:30
Installing Docker, setting it up for Jenkins, and installing Jenkins.
#!/bin/bash
# Copied from: https://raw.githubusercontent.com/wardviaene/jenkins-course/master/scripts/install_jenkins.sh
# Updated with : https://docs.docker.com/install/linux/docker-ce/ubuntu/
# this script is only tested on ubuntu xenial and bionic
# sudo is only if you are not on root (you should not be on root)
# Uninstall previous versions of docker
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
@baamenabar
baamenabar / FlieList-mock-creator.ts
Created September 13, 2020 12:02
Create a mock FileList to test file upload components.
/** list of mock File elements to pass the input[file] */
export function getBrowsedFiles(): FileList {
return fileListFromArray([
mockFileCreator({ name: 'file-one.png', type: 'image/png', size: 234 * 1000 }),
mockFileCreator({ name: 'file-two.gif', type: 'image/gif', size: 56 * 1000 }),
]);
}
export function mockFileCreator({
name = 'file.txt',