Skip to content

Instantly share code, notes, and snippets.

View chriskapp's full-sized avatar

Christoph Kappestein chriskapp

View GitHub Profile
@chriskapp
chriskapp / log_sender.php
Created January 9, 2016 20:45
Send apache log files per mail
<?php
define('BASE_PATH', '/var/log/apache2');
define('MAX_LINES', 256);
define('RECEIVER', '');
function generateAccessLogs(array $files)
{
$message = '';
foreach ($files as $file) {
@chriskapp
chriskapp / Entity.php
Last active March 10, 2018 09:17
PSX sample entity controller
<?php
namespace App\Api\Todo;
use PSX\Framework\Controller\SchemaApiAbstract;
use PSX\Http\Environment\HttpContextInterface;
/**
* @PathParam(name="todo_id", type="integer")
*/
@chriskapp
chriskapp / Collection.php
Last active March 10, 2018 09:16
PSX sample collection controller
<?php
namespace App\Api\Todo;
use PSX\Framework\Controller\SchemaApiAbstract;
use PSX\Http\Environment\HttpContextInterface;
class Collection extends SchemaApiAbstract
{
/**
@chriskapp
chriskapp / collection.php
Last active May 11, 2018 16:06
Fusio collection action
<?php
/**
* @var \Fusio\Engine\ConnectorInterface $connector
* @var \Fusio\Engine\ContextInterface $context
* @var \Fusio\Engine\RequestInterface $request
* @var \Fusio\Engine\Response\FactoryInterface $response
* @var \Fusio\Engine\ProcessorInterface $processor
* @var \Psr\Log\LoggerInterface $logger
* @var \Psr\SimpleCache\CacheInterface $cache
*/
@chriskapp
chriskapp / insert.php
Last active May 11, 2018 16:06
Fusio insert action
<?php
/**
* @var \Fusio\Engine\ConnectorInterface $connector
* @var \Fusio\Engine\ContextInterface $context
* @var \Fusio\Engine\RequestInterface $request
* @var \Fusio\Engine\Response\FactoryInterface $response
* @var \Fusio\Engine\ProcessorInterface $processor
* @var \Psr\Log\LoggerInterface $logger
* @var \Psr\SimpleCache\CacheInterface $cache
*/
@chriskapp
chriskapp / http-proxy.go
Created November 17, 2018 22:04
Simple whitelist HTTP proxy
package main
import (
"io/ioutil"
"log"
"net/http"
"regexp"
"github.com/elazarl/goproxy"
yaml "gopkg.in/yaml.v2"
@chriskapp
chriskapp / hashcheck.go
Last active December 24, 2018 10:32
Simple tool to verify checksums of files
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"fmt"
"hash"
"io"
"log"
@chriskapp
chriskapp / eloquent.php
Created February 9, 2020 08:16
Example usage of the Laravel adapter
<?php
use \Illuminate\Database\Capsule\Manager as Capsule;
$connection = $connector->getConnection('eloquent');
$actions = Capsule::table('fusio_action')->where('id', '>', 2)->get();
return $response->build(200, [], [
'actions' => $actions,
<?php
namespace App\Action;
use Doctrine\ORM\EntityManager;
use Fusio\Engine\ActionAbstract;
use Fusio\Engine\ContextInterface;
use Fusio\Engine\ParametersInterface;
use Fusio\Engine\RequestInterface;
use JMS\Serializer\ArrayTransformerInterface;
{
"definitions": {
"my_object": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"parent": {
"type": "object",