Skip to content

Instantly share code, notes, and snippets.

@stefanvangastel
stefanvangastel / SoapClientCurl.php
Last active May 5, 2022 17:43
PHP 5.3 SoapClient with cURL request
/**
* Class SoapClientCurl extends SoapClient __doRequest method with curl powered method
*/
class SoapClientCurl extends SoapClient{
//Required variables
public $url = null;
public $certfile = null;
public $keyfile = null;
public $passphrase = null;
@stefanvangastel
stefanvangastel / appDirectives.js
Created March 17, 2015 09:50
CakePHP 3 form validation message by AngularJS directive
var appDirectives = angular.module('appDirectives', []);
/**
* Add potential validation fields to form-control form elements (CakePHP 3 with Bootstrap)
*
* Requirement: $scope.errors contains option (validation) errors in default CakePHP 3 JSON response
*/
appDirectives.directive('formControl', function($compile) {
return {
restrict: 'C', //Match all elements with form-control class
@stefanvangastel
stefanvangastel / porche.jpg
Created June 1, 2015 15:01
Base64 encoded OpenALPR example image
/9j/4RX8RXhpZgAATU0AKgAAAAgADAEAAAMAAAABBAAAAAEBAAMAAAABAkAAAAECAAMAAAADAAAAngEGAAMAAAABAAIAAAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEaAAUAAAABAAAApAEbAAUAAAABAAAArAEoAAMAAAABAAIAAAExAAIAAAAcAAAAtAEyAAIAAAAUAAAA0IdpAAQAAAABAAAA5AAAARwACAAIAAgACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzADIwMTI6MDU6MTYgMjI6NTM6NDkAAASQAAAHAAAABDAyMjGgAQADAAAAAf//AACgAgAEAAAAAQAAAnygAwAEAAAAAQAAAWYAAAAAAAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABagEbAAUAAAABAAABcgEoAAMAAAABAAIAAAIBAAQAAAABAAABegICAAQAAAABAAAUegAAAAAAAABIAAAAAQAAAEgAAAAB/9j/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwPFRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAFoAoAMBIgACEQEDEQH/3QAEAAr/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEFAQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMicYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eX
@stefanvangastel
stefanvangastel / firebaseAngularJsExample.html
Created September 16, 2015 15:39
One file Firebase AngularJS Angularfire example
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Firebase AngularJS Demo</title>
<!-- AngularJS -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<!-- Firebase -->
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
@stefanvangastel
stefanvangastel / default.ctp
Last active October 10, 2017 15:11 — forked from ichord/gist:9808444
demo of using pdf.js to extract pages to images in CakePHP (http://book.cakephp.org/3.0/en/views.html#using-view-blocks)
//Your layout file
<html>
<head>
//etc
</head>
<body>
//Bla bla
<?php
vamp-workflow-health:
environment:
VAMP_KEY_VALUE_STORE_TYPE: consul
VAMP_KEY_VALUE_STORE_CONNECTION: consul:8500
VAMP_URL: http://vamp:8080
VAMP_KEY_VALUE_STORE_ROOT_PATH: /vamp/workflow/health
labels:
breed: health
workflow: health
image: magneticio/vamp-workflow-agent:0.9.0
@stefanvangastel
stefanvangastel / docker-load-and-push.sh
Last active March 9, 2023 23:19
Bash scripts to pull, (optional) retag, save, load and push Docker images. Created to provide easy means to download an image, retag it to use a private registry and then save it to an external disk. In a offline or on-premise environment you can use the load and push script to load images and push them to a private registry.
#!/bin/bash
#### Functions ###
display_usage() {
echo "This script must be run with Docker capable privileges and you should login to your registry before pushing!"
echo -e "\nUsage:\n$0 <saved_image> [--push]\n"
echo -e " <saved_image>\t\t\tThe image file to load and push"
echo -e " [--push]\t\t\tPush to registry"
echo -e "\nExample: $0 /mydir/ubuntu.tar --push "
}
@stefanvangastel
stefanvangastel / bootstrap.php
Last active March 19, 2017 09:30
CakePHP 3 + Syslog + Logstash + Elasticsearch, these gists are source for a blogpost regarding the out of the box syslog engine for CakePHP 3 and using logstash to push them to elasticsearch
# Change default log engine at the end of bootstrap.php
# See https://book.cakephp.org/3.0/en/core-libraries/logging.html#logging-to-syslog
Log::config('default', [
'engine' => 'Syslog',
'flag' => LOG_ODELAY | LOG_PERROR,
'facility' => LOG_LOCAL7, // Use local7 as dedicated syslog facilty for this app (https://en.wikipedia.org/wiki/Syslog#Facility)
'prefix' => 'MY_APP'
]);
@stefanvangastel
stefanvangastel / downloadLatestDrawioWar.sh
Created February 5, 2018 19:39
Download latest release of Draw.io as war file
#!/bin/bash
json=`curl -s -X GET https://api.github.com/repos/jgraph/drawio/tags`
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w 'name'`
version="$(echo $temp | cut -d\ -f3)"
curl -o "drawio-$version.war" -L https://github.com/jgraph/drawio/releases/download/$version/draw.war
@stefanvangastel
stefanvangastel / download.sh
Last active May 7, 2020 20:35
Download Conda repo's for offline use (including .conda files). First edit links.txt, then run and finish download.sh and end with downloadConda.sh
#!/bin/bash
for link in `cat links.txt`; do
wget -r -l1 -H -t1 -N -np -nH -P "pkgs/" --cut-dirs=1 -e robots=off -R "index.html*" $link
done
# -r recursive
# -l1 maximum recursion depth (1=use only this directory)
# -H span hosts (visit other hosts in the recursion)
# -t1 Number of retries
# -N turn on timestamping