Skip to content

Instantly share code, notes, and snippets.

View riccardobl's full-sized avatar

Riccardo Balbo riccardobl

View GitHub Profile
@riccardobl
riccardobl / micloopback.sh
Created January 20, 2016 16:29
Enable/Disable mic looback with pulseaudio
function enable {
pactl load-module module-loopback latency_msec=1 > ~/.micloopback.id
}
function disable {
pactl unload-module `cat ~/.micloopback.id`
}
if [ -f ~/.micloopback.id ]; then
@riccardobl
riccardobl / Video2GIF.sh
Last active February 4, 2016 17:24
Convert a video to a gif file.
#!/bin/bash
#
# Usage: video2gif myvideo.mp4
#
temp_dir=/tmp/video2gif-`tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
echo "Using temp directory $temp_dir"
mkdir "$temp_dir"
ffmpeg -i "$1" -r 15 -vf scale=-1:-1 "$temp_dir/frame-%04d.gif"
convert -delay 1x15 -loop 0 "$temp_dir/frame-*.gif" "$temp_dir/animation.gif"
@riccardobl
riccardobl / updateOpenfire.sh
Created March 8, 2016 14:56
Script for updating openfire tar.gz installation
#Usage: ./updateOpenfire.sh DOWNLOADLINK
DL_LINK=$1
BACKUP=openfire_backup`date '+%M.%d.%m.%Y'`
mv openfire $BACKUP
rm openfire.tar.gz
wget $DL_LINK -O openfire.tar.gz
tar -xzf openfire.tar.gz
cp -Rvf $BACKUP/conf openfire/
cp -Rvf $BACKUP/embedded-db openfire/
// Testcase for http://hub.jmonkeyengine.org/t/see-if-a-mesh-has-been-changed/35346/
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.SceneGraphVisitor;
import com.jme3.scene.Spatial;
import com.jme3.scene.VertexBuffer;
sudo apt-get install build-essential
sudo apt-get build-dep imagemagick
wdir=/tmp/`tr -dc A-Za-z0-9 < /dev/urandom | head -c 4`-immgk
sudo rm -Rf "$wdir"
sudo mkdir -p "$wdir"
sudo chmod 777 -Rf "$wdir"
cd "$wdir"
Convert images to dds files with mipmaps and compression using imagemagick.
#Requirements
Imagemagick >= 6.8.6-10 : https://gist.github.com/riccardobl/3aabaf82f74675a7b75b5878a5411789
import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW;
import static org.lwjgl.opengl.GL15.glBindBuffer;
import static org.lwjgl.opengl.GL15.glBufferData;
import static org.lwjgl.opengl.GL15.glDeleteBuffers;
import static org.lwjgl.opengl.GL15.glGenBuffers;
import static org.lwjgl.opengl.GL30.glBindBufferBase;
import static org.lwjgl.opengl.GL31.GL_UNIFORM_BUFFER;
import java.io.IOException;
import java.lang.reflect.Field;
package tests;
import java.util.ArrayList;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
@riccardobl
riccardobl / Gradle task to merge Log4j2Plugins.dat .md
Last active March 5, 2024 06:27
Gradle task to merge Log4j2Plugins.dat

A gradle task that merges Log4j2Plugins.dat from the various dependencies in a single file.

Useful when building a standalone jar.

If Log4j2Plugins.dat is not properly merged, log4j2 will print something like this:

ERROR StatusLogger Unrecognized format specifier [d]
ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [thread]