Skip to content

Instantly share code, notes, and snippets.

View tippexs's full-sized avatar

Timo Stark tippexs

View GitHub Profile
<?php
namespace App\Controller\Admin;
use Cake\Core\Configure;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use Cake\Utility\Hash;
[
(int) 0 => object(App\Model\Entity\Monthlyvalue) {
'sum_vegi' => (float) 106,
'sum_mos' => null,
'sum_ges' => (float) 664,
'facility' => object(App\Model\Entity\Facility) {
'colorcode' => 'black',
'tour_id' => (int) 5,
$MMV = TableRegistry::get('Monthlyvalues');
$query = $MMV->find()->contain(['Facilities']);
$result = $query->select(['sum_vegi' => $query->func()->sum('Monthlyvalues.vegi_val'),
'sum_mos' => $query->func()->sum('Monthlyvalues.mos_val'),
'sum_ges' => $query->func()->sum('Monthlyvalues.nor_val'),
'Facilities.colorcode', 'Facilities.tour_id', 'Facilities.facility_type'
])
->where(['Monthlyvalues.year' => $year, 'Monthlyvalues.month' => $month,
'Monthlyvalues.day' => $day, 'Monthlyvalues.is_visible' => 'X', 'Facilities.tour_id IS NOT' => null])
->group(['Facilities.facility_type', 'Facilities.colorcode'])->toArray();
<FilesMatch "\.(ttf|otf|eot|woff|woff2)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "https://buchen.unterkunft-am-bodensee.com/"
</IfModule>
</FilesMatch>
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=fcgicache:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 443 ssl http2;
server_name www.lev-fos-bayern.de;
******
gzip on;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
@tippexs
tippexs / nginx.conf
Created October 14, 2019 06:51
Nginx Config
server {
listen 80;
server_name lev-fos-bayern.de www.lev-fos-bayern.de;
location / {
rewrite ^ https://www.lev-fos-bayern.de$request_uri? permanent;
}
function auth(r) {
r.subrequest("/auth2", {}, reply => {
var header = reply.headersOut['WWW-Authenticate'];
r.log(header);
var nonce = header.match(/(nonce=")(.*?)(?=")/i);
@tippexs
tippexs / README.md
Created January 14, 2021 09:28 — forked from ogarrett/README.md
NGINX Plus Health Check - mark node as unhealthy if bandwidth utilisation exceeds threshhold

Overview

Requirement is for NGINX Plus to back off and stop sending new connections to an upstream node if the network utilization for that node exceeds a given threshhold.

Strategy

Create a simple HTTP-accessible script that runs on each upstream node. Script returns 200 OK (HTTP status code) if node is not overloaded, and 503 Too Busy if node is overloaded.

sub copy_file($) {
my ($name) = @_;
my $srcdir;
if (defined $ENV{TEST_NGINX_SRC}) {
$srcdir = $ENV{TEST_NGINX_SRC};
} else {
$srcdir = ".";
}
@tippexs
tippexs / auth_jwe_demo.pl
Created March 4, 2021 10:03
Auth JWE demo
#!/usr/bin/perl
use Crypt::JWT;
use Crypt::Misc;
use Data::Dumper;
$Data::Dumper::Terse = 1;
# specify the key to encrypt payload and produce tag - it should match enc algorithm used
# In our case for a A128CBC-HS256 key we need 256bit base64u encoded key-string.