Skip to content

Instantly share code, notes, and snippets.

View facholi's full-sized avatar

Rodrigo Facholi facholi

View GitHub Profile
@facholi
facholi / docker-cmds.txt
Created August 16, 2018 19:46
Docker commands
# verificar qual o arquivo de log de saída do conteiner
docker inspect --format='{{.LogPath}}' container
@facholi
facholi / index.js
Created September 16, 2016 20:35
Node.js script to runs on AWS Lambda. Converts the PDF pages to JPG images
var async = require("async");
var AWS = require("aws-sdk");
var gm = require("gm").subClass({imageMagick: true});
var fs = require("fs");
var mktemp = require("mktemp");
var PAGE_WIDTH = 1300,
PAGE_HEIGHT = 1300;
var utils = {
@facholi
facholi / convert-pdf.sh
Created September 16, 2016 20:31
With a list of object names as argument, this script download each pdf file from AWS S3 and converts the pages to JPG images
#!/bin/sh
bucket="multiplat-resources-homolog/";
prefix="content/";
while read -r line || [[ -n $line ]]; do
echo "downloading file $line";
pdfname=$(echo "$line" | sed 's/-original//');
aws s3 cp s3://$bucket$prefix$line $pdfname.pdf;
mkdir $pdfname;
@facholi
facholi / util_commands.txt
Created September 16, 2016 20:29
command line notes
// list all subdirectories of the current directory showing the total of files
find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
// total of files on the current directory
find . -type f | wc -l
# download jetty
sudo wget http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.2.9.v20150224.tar.gz
# unpack it
sudo tar zxvf jetty-distribution-9.2.9.v20150224.tar.gz
# create a simbolic link
ln -s jetty-distribution-9.2.9.v20150224/ jetty
# it make the command 'service jetty start' possible
@facholi
facholi / ec2-oracle-jdk-install.sh
Created February 27, 2015 17:46
Procedure for installing and setting Oracle JDK Java on Amazon EC2
# get the latest jdk version
wget -c --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.rpm"
# install it
sudo rpm -i jdk-8u31-linux-x64.rpm
# create the alternative
sudo alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
# configure the alternative