Skip to content

Instantly share code, notes, and snippets.

View andreasfi's full-sized avatar

Andreas Fischer andreasfi

View GitHub Profile
@andreasfi
andreasfi / canonical-redirect.htaccess
Last active May 24, 2026 11:23
Canonical HTTPS + WWW Redirect for Apache (.htaccess)
# >>> Canonical Redirect (HTTPS + WWW)
<IfModule mod_rewrite.c>
RewriteEngine On
# Allow Let's Encrypt validation
RewriteRule ^\.well-known/acme-challenge/ - [L]
# Force canonical HTTPS + WWW domain
RewriteCond %{HTTP_HOST} !^www\.example\.ch$ [NC,OR]
RewriteCond %{HTTPS} !=on
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
// Atleast one uppercase, one lowercase and one number
regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/
@andreasfi
andreasfi / stack axioms
Created October 19, 2017 15:18
stack axioms
Generator
empty:->stack
push:stack,E->stack
Operations
size:stack->E
pop:stack->stack
top:stack->E
Axioms
size(empty) = 0
size(push(s,e)) = succ(size(s))
@andreasfi
andreasfi / list axioms
Last active October 19, 2017 14:55
list axioms
generator
empty:->list
append: list, natural ->list
Operations
size: list->natural
nth: list, natural ->list
Axioms
size(empty) = 0
size(append(l,n)) = size(l)+1
nth(append(l,n),0) = 0
@andreasfi
andreasfi / h1.lua
Created September 28, 2017 15:19
For
for key, value in pairs(petrinet.transitions.t1.arcs) do
print (key, value.source.name, value.weight, petrinet.transitions.t1.name)
end
@andreasfi
andreasfi / petrinet.lua
Created September 28, 2017 14:40
Petrinet 1
local petrinet = {
places = {"p1","p2","p3"},
transitions = {"t"},
flow = {
-- places, transitions, weight
{ places[0], transitions[0],2 },
{ places[1], transitions[0],1 },
{ places[2], transitions[0],2 },
}
}