Skip to content

Instantly share code, notes, and snippets.

View javierarilos's full-sized avatar

javier arias losada javierarilos

View GitHub Profile
@javierarilos
javierarilos / groovying_camel.groovy
Created March 8, 2017 07:39
Groovying Camel: Proof of concept for dynamically starting Apache Camel routes from Groovy.
/*
Proof of concept of starting Apache Camel routes.
Grabs all dependencies, starts Camel and adds two routes to it.
- Timer to console
- Websockets => RabbitMQ
Usage:
>>> groovy groovying_camel.groovy
End with CTRL+C

Docker as a packaging deployment and execution environment

Before starting, Docker is a very interesting, even revolutionary technology. And is so powerful that has many use-cases and ways to explain what it does.

Here, we are talking about Docker as a tool for packaging and executing our applications, whatever they are.

What is Docker?

"Docker allows you to package an application with all of its dependencies into a standardized unit for software development."

When Docker was created, many people sold it as 'lighter Virtual Machines' and, while that is true, Docker appeal lays in its ability not to just RUN but to PACKAGE and DEPLOY applications in an isolated and repeatable way.

@javierarilos
javierarilos / execute_bash_command.py
Created October 13, 2015 11:41
Execute a Bash command in python, getting back return code, stdin and stdout.
import subprocess
p = subprocess.Popen(['ls', '-la'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
o, e = p.communicate()
print "Executed command ls -la with returncode", p.returncode
print " stdout ", o
print " error ", e

GIT fast intro for non dummies

Who is this guide for

This is a small introduction for people that maybe has been playing a little bit with GIT without reading a lot about it or is quite experienced with other VCS (Version Control Systems).

We will assume that you already have GIT installed Installing Git, and you know how to work with the command line.

Some Git good practices

This should be the last section of the guide, but since this is a guide for non-dummies, you already know many of the things explained below. So, for that reason I want you to read this before getting bored with the rest of the guide.

Positive good practices

@javierarilos
javierarilos / hello.cpp
Created September 10, 2015 08:27
Hello World C++ with compilation instructions (Linux)
// two options to compile:
// gcc hello.cpp -o hello -x c++ -v -lstdc++
// g++ hello.cpp -o hello
// then execute:
// ./hello
#include <iostream>
int main(void)
{
std::cout << "Hello World!";
@javierarilos
javierarilos / gitpull.py
Created September 4, 2015 10:44
Recursively enters into a directory subdirs and does git pull --rebase
#!/usr/bin/env python3
"""
Recursively enters into a directory subdirs and does git pull --rebase
"""
import os
import sys
from subprocess import call
@javierarilos
javierarilos / show_desktop.sh
Created July 28, 2015 10:31
XFCE4 show desktop workspace when changing it.
#!/bin/bash
#Description: Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: xfce4-notifyd, libnotify, wmctrl
CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
while true
do
sleep 1
NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
@javierarilos
javierarilos / show_panel.sh
Created July 28, 2015 10:30
XFCE4 show and hide panel
#!/bin/bash
#Description: xfconf-query to get the panel, and change its configuration
#If it is not working, check you have xfce4-panel: xfconf-query should list it.
#Then, check your panel name: xfconf-query -c xfce4-panel -l and modify it in the
#commands.
xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s false
sleep 2
xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s true
@javierarilos
javierarilos / xfce4-keyboard-shortcuts.xml
Created July 23, 2015 08:02
XFCE4 keyboard shortcuts configuration - custom section
<property name="custom" type="empty
<property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>
<property name="&lt;Control&gt;&lt;Alt&gt;L" type="string" value="xfce4-session-logout"/>
<property name="&lt;Super&gt;n" type="string" value="gnome-do"/>
<property name="&lt;Super&gt;m" type="string" value="xfce4-popup-whiskermenu"/>
<property name="&lt;Super&gt;c" type="string" value="xfce4-popup-clipman"/>
<property name="&lt;Super&gt;t" type="string" value="terminator"/>
<property name="&lt;Super&gt;Page_Up" type="string" value="amixer set Master 5%+ "/>
<property name="&lt;Super&gt;Page_Down" type="string" value="amixer set Master 5%-"/>
<property name="&lt;Super&gt;Home" type="string" value="amixer set Master toggle"/>
@javierarilos
javierarilos / rename_using_exif.sh
Created July 22, 2015 21:56
Rename image using date from EXIF data
FILE="20150511-10_19_36-2015-05-11 10.19.23.jpg"
DATETIMEORIGINAL=$(exiftool -p '$DateTimeOriginal' "$FILE")
DATE=$(echo $DATETIMEORIGINAL | awk '{print $1}' | tr -d ':')
TIME=$(echo $DATETIMEORIGINAL | awk '{print $2}' | tr ':' '_')
NEWNAME=$DATE-$TIME-$FILE