Skip to content

Instantly share code, notes, and snippets.

View iGEL's full-sized avatar

Johannes Barre iGEL

View GitHub Profile
@iGEL
iGEL / buergerbot.rb
Last active March 1, 2023 15:50 — forked from pbock/buergerbot.rb
Bürgerbot: Refreshes the Berlin Bürgeramt page until an appointment becomes available, then notifies you.
#!/usr/bin/env ruby
require 'watir'
require 'notify'
def log (message) puts " #{message}" end
def success (message) puts "+ #{message}" end
def fail (message) puts "- #{message}" end
def notify (message)
success message.upcase
Notify.notify 'Burgerbot', message
FROM debian
RUN apt-get update && apt-get install -y --no-install-recommends chromium
CMD chromium --headless --verbose --no-sandbox --screenshot https://www.chromestatus.com
@iGEL
iGEL / check_out.clj
Last active March 5, 2020 10:16
Clojure version of the tests for Kata 09
;; This is an adapted version of the tests from http://codekata.com/kata/kata09-back-to-the-checkout/ for Clojure
;; Original version by Dave Thomas
;; Run it like this:
;; lein exec check_out.clj
;; # or with Docker:
;; docker run -v `pwd`:`pwd` -w `pwd` clojure:alpine lein exec check_out.clj
(ns check-out.core
(:require [clojure.test :refer [is are deftest testing run-tests]]
@iGEL
iGEL / script.rb
Last active February 6, 2018 23:17
Bringt uns die Zeitumstellung mehr Sonnenlicht?
require 'sun_times'
# 1. Install ruby
# 2. gem install ruby-sun-times
# 3. ruby sun.rb
def f(t)
t.strftime("%H:%M")
end
@iGEL
iGEL / enforce_workspace.tf
Last active January 30, 2018 14:35
Enforce terraform workspaces can be only applied from a certain branch
# Source: https://gist.github.com/iGEL/3cecd4bf5518a627cb2aaf9802c37f14
# Fails if the user is currently not on the configured branch in git.
# Output doesn't matter, only that it succeeds (exit status 0).
# Current terraform version: v0.11.2
data "external" "enforce_workspace" {
program = ["./git-branch"]
query = {
diff --git a/spec/rubocop/cop/style/lambda_call_spec.rb b/spec/rubocop/cop/style/lambda_call_spec.rb
index abbd89c..93d37b9 100644
--- a/spec/rubocop/cop/style/lambda_call_spec.rb
+++ b/spec/rubocop/cop/style/lambda_call_spec.rb
@@ -61,5 +61,15 @@ describe RuboCop::Cop::Style::LambdaCall, :config do
new_source = autocorrect_source(['a.call(x)'])
expect(new_source).to eq('a.(x)')
end
+
+ it 'auto-corrects x.call to x.()' do
@iGEL
iGEL / mail_patch.rb
Created March 3, 2017 09:15
Safe monkey patched mail 2.6.4 deprecation warnings for Ruby 2.4
# frozen_string_literal: true
unless Mail::VERSION.version == "2.6.4"
raise "Please delete #{__FILE__}, it's not required anymore"
end
# This file monkey patches away the new deprecation warnings from Ruby 2.4.
# Lifted here:
# * https://github.com/mikel/mail/pull/1053
# * https://github.com/mikel/mail/pull/1058
@iGEL
iGEL / keybase.md
Last active February 8, 2018 23:18

Keybase proof

I hereby claim:

  • I am igel on github.
  • I am igelei (https://keybase.io/igelei) on keybase.
  • I have a public key ASDx5e08AAwZryDHFw8SUstrqXo7r9JFyYuYES17Xmqw2Ao

To claim this, I am signing this object:

@iGEL
iGEL / webmock_curl.rb
Last active September 9, 2015 14:16
Patch WebMock to print the curl command on disabled net connect. Just copy & paste it to execute.
module WebMock
class NetConnectNotAllowedError < Exception
alias_method :stubbing_instructions_without_curl, :stubbing_instructions
private
def stubbing_instructions(request_signature)
[
stubbing_instructions_without_curl(request_signature),
CurlInstructions.new(request_signature).instructions
@iGEL
iGEL / check_out_spec.rb
Last active April 14, 2022 16:10
RSpec version of the tests for Kata 09
# This is a reimplementation of the tests of this kata:
# http://codekata.com/kata/kata09-back-to-the-checkout/
# Original implementation by Dave Thomas
RSpec.describe CheckOut do
# Item Unit Special
# Price Price
# --------------------------
# A 50 3 for 130
# B 30 2 for 45