Skip to content

Instantly share code, notes, and snippets.

View theprivileges's full-sized avatar
BUIDL

Luiz Lopes theprivileges

BUIDL
View GitHub Profile
# This workflow will build and push a new container image to Amazon ECR, and then deploy a new task definition to Amazon ECS.
#
# To use this workflow, assume you have your infrastructure already provisioned, if not, you will need to complete the following set-up steps:
#
# 1. Create an ECR repository to store your images.
# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-1`.
# Replace the value of the `ECR_REPOSITORY` environment variable in the workflow below with your repository's name.
# Replace the value of the `AWS_REGION` environment variable in the workflow below with your repository's region.
#
# 2. Create an ECS task definition, an ECS cluster, and an ECS service.
@theprivileges
theprivileges / clamav.md
Created September 20, 2021 21:10
How to install and run ClamAV on Mac

install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

install clamav

brew install clamav
@theprivileges
theprivileges / clean-branches.sh
Created April 14, 2020 19:29
Delete stale branches from local copy of a cloned repository
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D
@theprivileges
theprivileges / username_generator.sh
Created November 29, 2019 04:07
Generate a random username for website accounts, in order to decrease the likelihood of tracking.
date | md5sum | cut -c 1-10 | pbcopy
@theprivileges
theprivileges / getRandomDate.js
Last active March 8, 2020 21:04
Simple function that returns a random date string given a date range.
/**
* Give a start and end Date object, returns a string representation of a random Date between the start and end dates.
*
* @param {object} start — Date object specifing the start date.
* @param {object} end — Date object specifiing the end date.
* @example
* // may return "Wed Jan 30 2019 18:26:45 GMT-0700 (Mountain Standard Time)"
* getRandomDate(new Date(2019, 0, 1), new Date())
* @example
* // mary return "Wed Jun 12 2002 08:53:15 GMT-0600 (Mountain Daylight Time)"
@theprivileges
theprivileges / createThumbnail.js
Created July 5, 2019 19:45
AWS Lambda tool resizes images based on Amazon S3 Events.
'use strict';
// dependencies
const async = require('async');
const AWS = require('aws-sdk');
const gm = require('gm').subClass({
imageMagick: true
}); // Enable ImageMagick integration.
const fs = require('fs');
const path = require('path');
function immutableSplice(arr, start, deleteCount, ...items) {
return [ ...arr.slice(0, start), ...items, ...arr.slice(start + deleteCount) ]
}
@theprivileges
theprivileges / searchInArray.js
Last active May 2, 2019 06:12
search in array given a key, value combination.
const labels = [
{ id: 1, name:"string 1", value:"this", other: "that" },
{ id: 2, name:"string 2", value:"this", other: "that" },
{ id: 3, name:"string 2", value:"this", other: "that" },
];
const selected = [1,3];
const searchInArray = (array, prop, value) => array.filter(element => element[prop] === value);
@theprivileges
theprivileges / index.html
Last active August 30, 2018 21:47
JSON Data Example// source http://jsbin.com/vamenih
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JSON Data Example</title>
</head>
<body>
<div id="main"></div>
<script type="application/json" id="data">
@theprivileges
theprivileges / Microsoft Edge Testing on VirtualBox.md
Created May 23, 2018 15:15
A simple guide on how to use VirtualBox and Virtual Machine images from modern.ie so you can test your project on MSEdge.

The following are the steps for downloading and running MSEdge on VirtualBox.

Step 1 — Download Virtual Box

Head to https://www.virtualbox.org/wiki/Downloads, and download the appropriate platform package.

Step 2 — Download Virtual Machine

Microsoft's modern.ie has kindly provided us with images from IE8 to MSEdge. You can download these images at https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/.

  • Select the MSEdge option under Virtual Machine.
  • Select VirtualBox under Platform.