Skip to content

Instantly share code, notes, and snippets.

View lauer's full-sized avatar

Jesper Grann Laursen lauer

View GitHub Profile
#!/bin/bash
#
# Check if Apple Store is back each 30 seconds
#
while [ "0" = "0" ]
do
curlgrep=`curl http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore 2>/dev/null | grep "back soon"`
if [ "$curlgrep" = "" ]
then
osascript -e "tell application \"System Events\" to display dialog \"Apple Store back online\nhttp://store.apple.com\"" &
@lauer
lauer / move_users.sh
Created August 23, 2011 12:11
copy unix users member of a specific group to another server
#!/bin/sh
# Move users from a specific group to an other server, including their
# .ssh-files. The script was created for migration of svn users to an
# other server.
# version 0.0.5
# Created by Jesper Grann Laursen <powerlauer@gmail.com>
# Gist: https://gist.github.com/1164958
@lauer
lauer / gratisdns.class.rb
Created January 22, 2012 18:26
GratisDNS.dk ruby class
# Version 0.1
# Updated: 22. January 2012
# Created by Jesper Grann Laursen - powerlauer@gmail.com
require 'net/http'
require 'net/https'
require 'rubygems'
require 'hpricot'
class GratisDNS
@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>
@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
#!/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 / 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.
@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
{
"wavin": [
{
"sensorid": 0,
"channelid": 0,
"location": "Bryggers"
},
{
"sensorid": 1,
"channelid": 1,
@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'