Skip to content

git pre-commit Hooks

A very common use case for hooks in git is a "pre-commit" hook. This hook is used to verify the to-be-committed data before it is added to the repository.

One important note: hooks are not part of the repository itself. Everyone can install a hook on it's own checkout of a repository, but by default the hook is not there when you clone/checkout the repository. This avoids security problems by executing arbitrary code during "git commit", or any "git" operation.
Because of this implication it is common that developers install a hook from somewhere in the repository into the ".git/hooks" directory. And in addition, the server side (the repository) can run the same checks during "git push", to enforce the rules.

Hooks in git work in a simple way: whatever program or script is run as the hook has to set a return code. If the return code is "0", git proceeds. If it's not "0", git aborts the operation.

 

Continue reading "git pre-commit Hooks"
  • Twitter
  • Bookmark git pre-commit Hooks at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg git pre-commit Hooks
  • Bloglines git pre-commit Hooks
  • Technorati git pre-commit Hooks
  • Fark this: git pre-commit Hooks
  • Bookmark git pre-commit Hooks at YahooMyWeb
  • Bookmark git pre-commit Hooks at Furl.net
  • Bookmark git pre-commit Hooks at reddit.com
  • Bookmark git pre-commit Hooks at blinklist.com
  • Bookmark git pre-commit Hooks at Spurl.net
  • Bookmark git pre-commit Hooks at Simpy.com
  • Bookmark git pre-commit Hooks at blogmarks
  • Bookmark git pre-commit Hooks with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Remove duplicates from Huginn event stream

One of the things I'm using Huginn for is monitoring for Twitter keywords. Some of them might appear in pairs, as example people like to tag Tweets about PostgreSQL with both #postgresql and #postgres. When I was using IFTTT this always created two emails, one for each hashtag. With Huginn I can deduplicate the events, and only notify about the first occurrence.

I need the following agents for this scenario:

 

 

Continue reading "Remove duplicates from Huginn event stream"
  • Twitter
  • Bookmark Remove duplicates from Huginn event stream at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Remove duplicates from Huginn event stream
  • Bloglines Remove duplicates from Huginn event stream
  • Technorati Remove duplicates from Huginn event stream
  • Fark this: Remove duplicates from Huginn event stream
  • Bookmark Remove duplicates from Huginn event stream at YahooMyWeb
  • Bookmark Remove duplicates from Huginn event stream at Furl.net
  • Bookmark Remove duplicates from Huginn event stream at reddit.com
  • Bookmark Remove duplicates from Huginn event stream at blinklist.com
  • Bookmark Remove duplicates from Huginn event stream at Spurl.net
  • Bookmark Remove duplicates from Huginn event stream at Simpy.com
  • Bookmark Remove duplicates from Huginn event stream at blogmarks
  • Bookmark Remove duplicates from Huginn event stream with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Enable Huginn Twitter integration

Huginn comes with a number of Twitter agents, but before they can be used you need to authenticate them. That process requires multiple steps, and they are not well documented.

The basics are described on the "Configuring OAuth applications" Wiki page.

For the Twitter integration one must know that you are using a single Twitter app for all users, but every Huginn user can (and should) have this app authenticated against their own Twitter account. Therefore if you want to use multiple Twitter accounts in Huginn, you need multiple Huginn users.

 

Continue reading "Enable Huginn Twitter integration"
  • Twitter
  • Bookmark Enable Huginn Twitter integration at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Enable Huginn Twitter integration
  • Bloglines Enable Huginn Twitter integration
  • Technorati Enable Huginn Twitter integration
  • Fark this: Enable Huginn Twitter integration
  • Bookmark Enable Huginn Twitter integration at YahooMyWeb
  • Bookmark Enable Huginn Twitter integration at Furl.net
  • Bookmark Enable Huginn Twitter integration at reddit.com
  • Bookmark Enable Huginn Twitter integration at blinklist.com
  • Bookmark Enable Huginn Twitter integration at Spurl.net
  • Bookmark Enable Huginn Twitter integration at Simpy.com
  • Bookmark Enable Huginn Twitter integration at blogmarks
  • Bookmark Enable Huginn Twitter integration with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Monitor software version changes with Huginn

Huginn is a great piece of software, but the documentation is ... a bit sparse. Especially when it comes to details of the agents. I'm going to blog about a couple more more examples in the future.

For another project I'm using Leaflet, a JavaScript library for rendering maps in a browser. New versions are released occasionally, and I want to know when it's time to update the project website. Huginn can do that.

 

Continue reading "Monitor software version changes with Huginn"
  • Twitter
  • Bookmark Monitor software version changes with Huginn at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Monitor software version changes with Huginn
  • Bloglines Monitor software version changes with Huginn
  • Technorati Monitor software version changes with Huginn
  • Fark this: Monitor software version changes with Huginn
  • Bookmark Monitor software version changes with Huginn at YahooMyWeb
  • Bookmark Monitor software version changes with Huginn at Furl.net
  • Bookmark Monitor software version changes with Huginn at reddit.com
  • Bookmark Monitor software version changes with Huginn at blinklist.com
  • Bookmark Monitor software version changes with Huginn at Spurl.net
  • Bookmark Monitor software version changes with Huginn at Simpy.com
  • Bookmark Monitor software version changes with Huginn at blogmarks
  • Bookmark Monitor software version changes with Huginn with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Monitor additional details in Telegraf with the "Exec" input filter

After installing Telegraf and hooking up everything into InfluxDB, I was missing the status of my backups. Every system here creates encrypted backups every night, and stores them on a central NAS, and off-site. But I want to know statistics about the backups, and see if something is not working.

I'm using Restic for the backups (will blog about this another time). However Telegraf does not support Restic directly, I need a few workarounds. This blog post however is not directly about monitoring the backups, but about how to write your own plugin for Telegraf.

 

Continue reading "Monitor additional details in Telegraf with the "Exec" input filter"
  • Twitter
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Monitor additional details in Telegraf with the "Exec" input filter
  • Bloglines Monitor additional details in Telegraf with the "Exec" input filter
  • Technorati Monitor additional details in Telegraf with the "Exec" input filter
  • Fark this: Monitor additional details in Telegraf with the "Exec" input filter
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at YahooMyWeb
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at Furl.net
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at reddit.com
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at blinklist.com
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at Spurl.net
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at Simpy.com
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter at blogmarks
  • Bookmark Monitor additional details in Telegraf with the "Exec" input filter with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Install Telegraf using Ansible

I have an InfluxDB up and running in my network, and decided to monitor all (well, all possible - the QNAP seems to be a problem) devices. That's quite easy to do by installing Telegraf as a server agent, and add some configuration. Everything is deployed using Ansible, so I can re-use the same Playbook for many devices.

 

Continue reading "Install Telegraf using Ansible"
  • Twitter
  • Bookmark Install Telegraf using Ansible at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Install Telegraf using Ansible
  • Bloglines Install Telegraf using Ansible
  • Technorati Install Telegraf using Ansible
  • Fark this: Install Telegraf using Ansible
  • Bookmark Install Telegraf using Ansible at YahooMyWeb
  • Bookmark Install Telegraf using Ansible at Furl.net
  • Bookmark Install Telegraf using Ansible at reddit.com
  • Bookmark Install Telegraf using Ansible at blinklist.com
  • Bookmark Install Telegraf using Ansible at Spurl.net
  • Bookmark Install Telegraf using Ansible at Simpy.com
  • Bookmark Install Telegraf using Ansible at blogmarks
  • Bookmark Install Telegraf using Ansible with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)

I'm in the process of updating my entire home setup, and integrate everything properly. Part of this process is to automate everything, and use Ansible Playbooks to deploy devices and configurations.

Today: install Telegraf and send data to InfluxDB

Along the way something broke, and Ansible doesn't really like me anymore. But let's start at the beginning.

In the Telegraf configuration in "/etc/telegraf/telegraf.conf" one can specify output plugins. One of them (probably the most used one) is "InfluxDB". The InfluxDB instance(s) are specified as a [...] list. In Ansible I somehow need to have this list as a string, and write it into the configuration file. This happens:

TASK [Update telegraf.conf InfluxDB settings] ***************************************************
changed: [localhost] => (item={'section': '[outputs.influxdb]', 'option': 'urls', 'value': ['http://192.168.xxx.xxx:8086'], 'state': 'present'})
[WARNING]: The value ['http://192.168.xxx.xxx:8086'] (type list) in a string field was converted to "['http://192.168.xxx.xxx:8086']" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.

Looks nasty ...

 

Continue reading "Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)"
  • Twitter
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)
  • Bloglines Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)
  • Technorati Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)
  • Fark this: Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string)
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at YahooMyWeb
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at Furl.net
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at reddit.com
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at blinklist.com
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at Spurl.net
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at Simpy.com
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) at blogmarks
  • Bookmark Add InfluxDB settings in Telegraf using Ansible: [WARNING]: The value [...] (type list) in a string field was converted to "[...]" (type string) with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Move InfluxDB data directory to a SDcard

For my openHAB system I installed InfluxDB (on a separate) Raspberry Pi. The Pi has a 32 GB SDcard, but that is not enough for storing all the data, and that Pi has additional work to do as well. For that reason I also attached a 1 TB disk to the Pi, and mounted it on /data. Now all I have to do is move the InfluxDB data directory to /data.

 

Continue reading "Move InfluxDB data directory to a SDcard"
  • Twitter
  • Bookmark Move InfluxDB data directory to a SDcard at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Move InfluxDB data directory to a SDcard
  • Bloglines Move InfluxDB data directory to a SDcard
  • Technorati Move InfluxDB data directory to a SDcard
  • Fark this: Move InfluxDB data directory to a SDcard
  • Bookmark Move InfluxDB data directory to a SDcard at YahooMyWeb
  • Bookmark Move InfluxDB data directory to a SDcard at Furl.net
  • Bookmark Move InfluxDB data directory to a SDcard at reddit.com
  • Bookmark Move InfluxDB data directory to a SDcard at blinklist.com
  • Bookmark Move InfluxDB data directory to a SDcard at Spurl.net
  • Bookmark Move InfluxDB data directory to a SDcard at Simpy.com
  • Bookmark Move InfluxDB data directory to a SDcard at blogmarks
  • Bookmark Move InfluxDB data directory to a SDcard with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5

A while ago I upgraded openHAB from version 2.4 to 2.5. That comes with the usual share of problems, but eventually I got it working.

For an unrelated project I wanted to use the OpenWeatherMap setup I have to improve the daily weather forecast with icons.

The binding provices ids for the current weather condition and the current weather icon. That can be used to load the icon from the OWM website. Went to my setup and added two new Items:

String	homeCurrentConditionID	"Current condition ID [%s]"	{ channel="openweathermap:weather-and-forecast:home:current#condition-id" }
String	homeCurrentIconID	"Current icon ID [%s]"		{ channel="openweathermap:weather-and-forecast:home:current#icon-id" }

Used Ansible to deploy everything to the Raspberry running openHAB. And then wondered because only the "homeCurrentConditionID" item came online, not the "homeCurrentIconID". After searching around and browsing the community forum, it turns out that the "icon-id" channel is new in 2.5, and will not automatically installed if the OpenWeatherMap binding was already used in 2.4. WT* ...

One has to remove all the OWM things ("openweathermap:weather-api:home" and "openweathermap:weather-and-forecast:home") and reinstall everything, in order to get the new channels working. That is really unexpected, and not user friendly.

After mumbling a while over my options I went ahead, created a new backup, and then removed the two items. One did get stuck along the way, a long Java trace appeared in the logfile, and I had to force remove it. Then - for good measueres - I also uninstalled the binding, and restarted openHAB.

Afterwards I re-deployed my Ansible Playbook, which installs the binding, takes care of the binding configuration, and adds the Things again. After everything came online, the homeCurrentIconID Item is also populated. Why is everything in openHAB so complicated?

  • Twitter
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5
  • Bloglines New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5
  • Technorati New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5
  • Fark this: New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at YahooMyWeb
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at Furl.net
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at reddit.com
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at blinklist.com
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at Spurl.net
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at Simpy.com
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 at blogmarks
  • Bookmark New OpenWeatherMap channels missing after openHAB upgrade from 2.4 to 2.5 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Find Telegram Group ID

Created a new Telegram Group for testing, and wanted to know the Group ID to send messages to the group using a bot.

One quick way (there are other ways as well):

  • Go to: https://web.telegram.org/
  • Login using your phone number
  • Telegram sends you a confirmation code to your client on your mobile device
  • Once you are logged in: click on the group
  • The URL changes to something like: https://web.telegram.org/#/im?p=g1234567
  • Pick the number after "p=g" (in this example: 1234567), and negate it (Group numbers in Telegram are negative)

The group number is: -1234567

  • Twitter
  • Bookmark Find Telegram Group ID at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Find Telegram Group ID
  • Bloglines Find Telegram Group ID
  • Technorati Find Telegram Group ID
  • Fark this: Find Telegram Group ID
  • Bookmark Find Telegram Group ID at YahooMyWeb
  • Bookmark Find Telegram Group ID at Furl.net
  • Bookmark Find Telegram Group ID at reddit.com
  • Bookmark Find Telegram Group ID at blinklist.com
  • Bookmark Find Telegram Group ID at Spurl.net
  • Bookmark Find Telegram Group ID at Simpy.com
  • Bookmark Find Telegram Group ID at blogmarks
  • Bookmark Find Telegram Group ID with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca