środa, 23 grudnia 2015

Quick fix for non-responding keyboard in Ubuntu

In order to unlock keyboard just restart ibus deamon
ibus-daemon -rd
PS. Check batteries in your keyboard if restarting does not help :)

Fun with awk - how to aggregate column values in bash

How to aggregate values in particular column

for i in $(ls); do du -sm $i; done | awk '{s+=$1;print s,$0} END{print "S:",s}'

środa, 16 grudnia 2015

Quick fix for disappeared time panel in Unity top bar

Forcing restart of unity-panel by killing it do the job. Ingenious ;D.
sudo killall unity-panel-service

niedziela, 13 grudnia 2015

How to deploy chosen artifacts of multimodule maven application

In case there is parent module you need to install also this parent pom.
  REPO_ID=myRepoIdDefinedInSettingsXml && \
  REPO_URL=http://example.com/nexus/content/repositories/releases && \
  VERSION=2.3.1 && \
  /usr/local/bin/mvn deploy:deploy-file \
     -DgroupId=${GROUP_ID} \
     -DartifactId=${PARENT_ARTIFACT_ID} \
     -Dpackaging=pom \
     -Dversion=${VERSION} \
     -DrepositoryId=${REPO_ID} \
     -Durl=${REPO_URL} \
     -Dfile=build/release-*/pom.xml && \
Once parent module is installed (but in fact doesn't need to be first) we can install our modules (MODULE1, MODULE4 and MODULE_N). Installing sources is optional (if your package phase does not generate source bundle - just skip -Dsource option.
    for FILE in $(find target/${ARTIFACTID} -name "${ARTIFACTID}*.jar" | grep -v sources); do \
      /usr/local/bin/mvn deploy:deploy-file \
        -DgroupId=${GROUP_ID} \
        -DartifactId=${ARTIFACTID} \
        -Dversion=${VERSION} \
        -DpomFile=$(dirname ${FILE})/../pom.xml \
        -Dpackaging=jar \
        -DrepositoryId=${REPO} \
        -Durl=${REPO_URL} \
        -Dfile=$(dirname ${FILE})/${ARTIFACTID}-${VERSION}.jar \
        -Dsources=$(dirname ${FILE})/${ARTIFACTID}-${VERSION}-sources.jar; \
    done; \
  done; \

How to run sql script against H2 file database with single command

There are cases when the quickest way to fix database is by running some sql script. Assuming you have used h2 in the past you're most likly have h2 driver in your m2 repo. Once you found it try the following:
 java -cp h2*.jar org.h2.tools.RunScript -url <URL> -script init.sql
where URL is default jdbc string and can be jdbc:h2:~/test