Skip to content

Instantly share code, notes, and snippets.

View mcaligares's full-sized avatar
🏡
Working from home

Caligares Miguel Augusto mcaligares

🏡
Working from home
View GitHub Profile
@mcaligares
mcaligares / aws_serverless_policy.json
Created April 3, 2024 23:37
AWS Serverless Policy Template
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudformation:List*",
"cloudformation:Get*",
"cloudformation:ValidateTemplate",
"ssm:*"
const { spawn } = require('child_process');
const ffmpeg = spawn('ffmpeg')
ffmpeg("ffmpeg -i input.mp4 -i input.mp3 -c copy -map 0:v:0 -map 1:a:0 output.mp4").stdout.on('data', (data) => {
console.log('data', data)
})
// mosaic for 3 videos
// ffmpeg("ffmpeg -i 01.mp4 -i 02.mp4 -i 03.mp4 -filter_complex \"nullsrc=size=640x480 [base]; [0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft]; [2:v] setpts=PTS-STARTPTS, scale=320x480:force_original_aspect_ratio=increase,crop=320:480[fullright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][lowerleft] overlay=shortest=1:y=240 [tmp2]; [tmp2][fullright] overlay=shortest=1:x=320\" output.mp4").stdout.on('data', (data) => {
// Based on http://pythonhackers.com/p/fluent-ffmpeg/node-fluent-ffmpeg
// and https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos
// Usage:
// node ffmpeg-mosaic.js file1.mp2 file2.mp4 file3.mp4 file4.mp4
// Generates out.mp4
var ffmpeg = require('fluent-ffmpeg');
var command = ffmpeg()
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@mcaligares
mcaligares / .gitconfig
Created July 31, 2017 21:09
Git Configuration File
[user]
email = mcaligares@gmail.com
name = Miguel Augusto Caligares
[alias]
co = checkout
hist = log --graph --abbrev-commit --decorate --date=local --all
i = status
@mcaligares
mcaligares / KeyLengthDetector.groovy
Created April 3, 2017 15:58
Detect the allowed size of AES keys on the JVM. If the size is <= 256, it is limited. To fix it JCE unlimted stregth files are needed. Raw
import javax.crypto.Cipher;
try {
println "The allowed key length for AES is: ${Cipher.getMaxAllowedKeyLength("AES");}"
} catch(Exception e) {
e.printStackTrace()
}
@mcaligares
mcaligares / moodlewsclient.java
Created January 4, 2017 10:14
Example for Moodle WS Client
/*
* This file is NOT a part of Moodle - http://moodle.org/
*
* This client for Moodle 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
package restjsonmoodleclient;
@mcaligares
mcaligares / guid.util.js
Created February 13, 2016 01:16
This will create an rfc4122 version 4 compliant UUID
function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
@mcaligares
mcaligares / waituntiljavastartsandkillothers.sh
Created February 9, 2016 18:38
Espera que el tomcat arranque y cierra el resto de instancias.
#@jon_eguiluz
waitUntilJavaStartsAndKillOthers (){
while true; do
find=`tail -n1 /home/sofiauser/tomcat7/logs/catalina.out | awk '{print $2$3}'`
if [ "$find" == "Serverstartup" ]; then
echo "Server started"
break
fi
done
killOldersJava
@mcaligares
mcaligares / Config.groovy
Last active June 1, 2017 23:06
Grails config for gmail
grails {
mail {
host = "smtp.gmail.com"
port = 465
username = "@gmail.com"
password = ""
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]