Skip to content

Instantly share code, notes, and snippets.

View lauer's full-sized avatar

Jesper Grann Laursen lauer

View GitHub Profile
@lauer
lauer / add_build_number.sh
Created December 7, 2021 07:33
Small script to jenkinsfile which set the last .0 on alpha releases to the $BUILD_NUMBER from jenkins
#!/usr/bin/env bash
set -e
if [[ -z "${BUILD_NUMBER}" ]]; then
echo "No build number set"
env
exit 0
fi
BUILD_VERSION=`jq -r '.version' package.json | sed "s/0$/${BUILD_NUMBER}/"`
@lauer
lauer / zdb5100.yaml
Created March 7, 2021 07:32
Blueprint for Logic Group ZDB5100
blueprint:
name: Logic Group Matrix ZDB5100
description: Create automatisation for the ZDB5100 using zwavejs integration
domain: automation
input:
matrix_zdb5100:
name: Matrix ZDB5100
description: The matrix to interact with
selector:
device:
@lauer
lauer / myip
Created May 25, 2020 07:28
Fast way to get External and Internal ip addresses
#!/bin/sh
echo "External: "
dig +short myip.opendns.com @resolver1.opendns.com
echo "Internal: "
ifconfig |grep inet | awk '{print $2}' |grep -v '127.0.0.1\|::1\|fe80::'
@lauer
lauer / env.rb
Created January 9, 2020 08:42
Solve problems with prepend and alias
# Note: cucumber-rails redefines the call method in ShowExceptions, leading to an infinite loop
# To make our tests work until that is properly fixed, we redefine call to the original method here
require 'action_dispatch'
module ActionDispatch
class ShowExceptions
alias original_call call
end
end
require 'cucumber/rails'
{
"wavin": [
{
"sensorid": 0,
"channelid": 0,
"location": "Bryggers"
},
{
"sensorid": 1,
"channelid": 1,
@lauer
lauer / wavin_read.py
Created August 29, 2018 11:30
Simple script to fetch data from a Wavin 9000 controller
#!/usr/bin/env python3
#
# Require: https://github.com/paller/wavin-controller
#
# Example output:
# AC-116
# MC11013 MC61019
# 0 23.4 90 32788 21.5
# 1 23.0 90 32788 21.5
# 2 23.1 90 32788 21.0
@lauer
lauer / dllogin
Created April 9, 2013 09:25
DLink rancid module Remember to add the following line to rancid-fe (and a , on the line before) 'dlink' => 'dlrancid', This is tested on a DGS-3427
#! /usr/bin/expect --
##
## patched to accomplish fortinet from nlogin
## in turn patched to accomplish D-Link from fnlogin
## by: Daniel G. Epstein <dan at rootlike.com>
## adapted by: Diego Ercolani <diego.ercolani at ssis.sm>
## further adapted by: Gavin McCullagh <gavin.mccullagh at gcd.ie>
##
## rancid 2.3.6
## Copyright (c) 1997-2009 by Terrapin Communications, Inc.
#!/bin/sh
#
# Script for backup MySQL databases in crontab
# Tested on ubuntu +10.04 LTS
#
# Created by Jesper Grann Laursen, powerlauer AT gmail DOT com
#
#
# configfile
config=/etc/backupDatabases.conf
@lauer
lauer / .zshrc
Last active October 12, 2015 12:07
.zshrc
# PATH=$PATH:~/bin
export TERM=rxvt
HISTSIZE=1000
SAVEHIST=1000
if (( ! EUID )); then
HISTFILE=~/.history_root
else
HISTFILE=~/.history
@lauer
lauer / _form.html.erb
Created March 17, 2012 22:37
Problems with controller.action_name in view tests
<%= form_for @car, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<legend><%=controller.action_name.capitalize %> Car</legend>
<div class="control-group">
<%= f.label :name, :class => 'control-label' %>
<div class="controls">
<%= f.text_field :name, :class => 'text_field' %>
</div>
</div>