Skip to content

Instantly share code, notes, and snippets.

View holderbaum's full-sized avatar

Jakob Holderbaum holderbaum

View GitHub Profile

certbot certonly --manual --preferred-challenges dns --manual-auth-hook auth.sh --manual-cleanup-hook cleanup.sh --staging -d DOMAIN

auth.sh:

#!/bin/bash

zone=_acme-challenge.$CERTBOT_DOMAIN
zone_file=/etc/bind/acme.zone
Feature: Serve Image
The service should return placholder of requested size and category.
Default size and default category should be used when either of them
is not provided.
Scenario: Serve image without any parameter
Given user wants a placeholder
When he requests the placeholder
Then an image is returned
def extract_log(dir)
`(cd #{dir} && git log --oneline --shortstat --pretty=format:%aE)`
end
def extract_stats(log_string)
log_string.split(/\n\n/).map do |log_entry|
StatEntry.new log_entry
end
end
@holderbaum
holderbaum / ranking.lua
Created January 21, 2014 17:32
Competiton ranking for redis
ocal offset = ARGV[1]
local limit = ARGV[2]
local users = redis.call('zrevrange', KEYS[1], offset, offset + limit, 'WITHSCORES')
local result = {}
for i=1,#users,2 do
local user = users[i]
local score = users[i+1]
local min_score = score + 1
local comp_rank = redis.call('zcount', KEYS[1] , min_score, '+inf') + 1
# Application namespace
class Manager
def creating_community(*args, &blk)
CreatingCommunity.new(*args).call(&blk)
end
def loading_community(*args, &blk)
LoadingCommunity.new(*args).call(&blk)
end
@holderbaum
holderbaum / prime.c
Created October 22, 2012 07:56
generate primes - non-optimized naive algorithm!
#include <stdio.h>
#include <stdlib.h>
char is_prime(int number) {
int i;
int limit = number/2;
for(i=2;i<=limit;i++) { if(number % i == 0) return 0; }
return 1;
};
@holderbaum
holderbaum / sorting.rb
Created October 3, 2012 09:23
Test for efficient sorting of an array of hashes
require 'benchmark'
class EntryHash < Hash
def <=>(other)
self[:value] <=> (other && other[:value] || 0)
end
end
@holderbaum
holderbaum / FlySimClientActivity.java
Created October 12, 2011 14:41
Android OpenGL Application
package com.android.apps;
import com.example.android.apis.R;
import android.app.Activity;
import android.os.Bundle;
import android.opengl.GLSurfaceView;
import android.view.Window;
import android.view.WindowManager;
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_proxy"
)
server.port = 80
mysql> select * from printings;
+-----------+-------------+------------+---------------------+---------------------+
| id | magazine_id | edition_id | created_at | updated_at |
+-----------+-------------+------------+---------------------+---------------------+
| 298486374 | NULL | NULL | 2011-07-08 17:28:06 | 2011-07-08 17:28:06 |
| 980190962 | NULL | NULL | 2011-07-08 17:28:06 | 2011-07-08 17:28:06 |
+-----------+-------------+------------+---------------------+---------------------+
require 'test_helper'