Skip to content

Instantly share code, notes, and snippets.

@wagnerpinheiro
wagnerpinheiro / avi2giv
Last active September 23, 2020 02:19
Create gif from avi files
!#/bin/bash
ffmpeg -i $1 -vf "fps=10,scale=1024:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 $1.gif
@wagnerpinheiro
wagnerpinheiro / 01-directory-structure.md
Created September 17, 2020 18:09 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
var body=document.body,
parent=body.querySelector(".JTable"),
rows=parent.querySelectorAll(".JTable-row"),
table=document.createElement("table"),
tbody=document.createElement("tbody"),
row=document.createElement("tr"),
cell=document.createElement("td"),
x=rows.length,
cells=rows[0].querySelectorAll(".JTable-cell"),
y=cells.length,
@wagnerpinheiro
wagnerpinheiro / makefile
Created November 26, 2019 20:59
A default makefile sample with help support
var_temp := x
# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@wagnerpinheiro
wagnerpinheiro / Makefile
Created September 17, 2018 02:22 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@wagnerpinheiro
wagnerpinheiro / Makefile
Created September 16, 2018 14:52 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wagnerpinheiro
wagnerpinheiro / role_arn_to_session.py
Created August 16, 2018 16:59 — forked from gene1wood/role_arn_to_session.py
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
import boto3
def role_arn_to_session(**args):
"""
Usage :
session = role_arn_to_session(
RoleArn='arn:aws:iam::012345678901:role/example-role',
RoleSessionName='ExampleSessionName')
client = session.client('sqs')
"""
@wagnerpinheiro
wagnerpinheiro / console_assume_role.py
Last active July 31, 2018 18:39 — forked from weavenet/console.py
Python script to assume STS role and generate AWS console URL.
#!/usr/bin/env python
import getpass
import json
import requests
import sys
import urllib
import boto3
@wagnerpinheiro
wagnerpinheiro / remove_public.py
Created July 11, 2018 22:50 — forked from MattHealy/remove_public.py
Python script to remove public access from all objects in an AWS S3 bucket
#!/usr/bin/env python
#remove public read right for all keys within a directory
#usage: remove_public.py bucketName folderName
import sys
import boto
from boto import connect_s3
@wagnerpinheiro
wagnerpinheiro / Dockerfile
Created November 7, 2016 13:43 — forked from kvzhuang/Dockerfile
My Dockerfile, initial shell script and run shell script.
# DOCKER-VERSION 0.3.4
FROM ubuntu
MAINTAINER Kevin Zhuang <kvzhuang@gmail.com>
#RUN echo "This is a ubuntu Dockerfile."
#replace source.list with http://repogen.simplylinux.ch/
RUN echo "deb http://02.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse" > /etc/apt/sources.list
RUN apt-get update