Skip to content

Instantly share code, notes, and snippets.

@kevinquinnyo
kevinquinnyo / hitch
Last active October 22, 2015 22:00 — forked from lkarsten/hitch
hitch init script for debian
#! /bin/sh
### BEGIN INIT INFO
# Provides: hitch
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The Scalable TLS Unwrapping Daemon
# Description: The Scalable TLS Unwrapping Daemon
include:
- varnish.config
base:
pkgrepo.managed:
- humanname: Varnish Cache 4.0
- name: deb https://repo.varnish-cache.org/ubuntu/ precise varnish-4.0
- dist: trusty
- file: /etc/apt/sources.list.d/varnish-cache.list
- require_in:
def web(self):
self.states[self.webroot_base] = {
'file.directory': [
{'name': self.webroot_base}
{'mode': 750},
{'owner': 'root'},
{'group': 'root'}
]
}
protected function _findUser($username, $password = null)
{
$userModel = $this->_config['userModel'];
list(, $model) = pluginSplit($userModel);
$fields = $this->_config['fields'];
$conditions = [$model . '.' . $fields['username'] => $username];
$scope = $this->_config['scope'];
if ($scope) {
@kevinquinnyo
kevinquinnyo / gist:96ff4130f882101e24d5
Last active August 29, 2015 14:22
BaseAuthenticate idea
<?php
abstract class BaseAuthenticate implements EventListenerInterface
{
// snip..
protected function _findUser($query, $username = null, $password = null)
{
$fields = $this->_config['fields'];
$array = [
'0' => [
'data' => [
'traffic_in' => [
'1',
'2',
'3',
'4'
],
'traffic_out' => [
Dataset 1 [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1.5,2]
95th percentile 1.5
Dataset 2 [200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,250,300]
95th percentile: 250
The sum of those Datasets' 95th's would be 251.5. This is "Stacked".
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start='1420076062' \
--end='1420162462' \
--title='EDGE-AA.atl01 - Traffic - Te1/1' \
--rigid \
--base='1000' \
--height='120' \
--width='500' \
--alt-autoscale-max \
/src/Controller/Api/V1/BandwidthGraphsController.php (line 52)
object(App\Model\Entity\BandwidthGraph) {
'new' => false,
'accessible' => [
'*' => true
],
'properties' => [
'id' => (int) 24,
<?php
// more efficient way to do this than creating an array of all permutations indexed by each value and comparing to eachother?
$array = [ 'asdfasdfasdf_X', 'asdfasdfasdf_Y', '123412341234_X', 'asdfasdfasdf_Z', '123412341234_Y', 'dsfjiowefnilknml' ];
$permutations = [];
for($i=0; $i<count($array); $i++) {
$key = array_shift($array);
$permutations[$key] = $array;