Skip to content

Instantly share code, notes, and snippets.

View jackdpeterson's full-sized avatar

Jack Peterson jackdpeterson

View GitHub Profile
@jackdpeterson
jackdpeterson / gist:aad48879a9c2e02f0882
Created January 15, 2015 19:59
Gluster 3.6.1 -- not matching 30601 operating-version on CentOS 6.6
[jpeterson@gluster6 glusterd]$ sudo cat glusterd.info
UUID=d9150a52-b892-4d23-a45e-b3f837daea3b
operating-version=30601
[jpeterson@gluster6 glusterd]$ sudo service glusterd restart
Starting glusterd: [FAILED]
[jpeterson@gluster6 glusterd]$ sudo nano glusterd.info
[jpeterson@gluster6 glusterd]$ sudo cat glusterd.info
UUID=d9150a52-b892-4d23-a45e-b3f837daea3b
<?php
namespace ZF\OAuth2\Observer;
use SplObserver;
use SplSubject;
class SyslogObserverImpl implements SplObserver
{
public function update(SplSubject $subject)
@jackdpeterson
jackdpeterson / bootstrap.php
Last active April 15, 2016 17:48
ZF2 PHPUnit bootstrap sample
<?php
namespace MyCompany;
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
error_reporting(E_ALL | E_STRICT);
chdir(__DIR__);
if (! defined('APPLICATION_ENV')) {
@jackdpeterson
jackdpeterson / phpunit.xml
Created April 15, 2016 17:20
phpunit.xml sample - with code coverage
<phpunit bootstrap="./bootstrap.php" colors="true">
<testsuites>
<testsuite name="MyCompany Test Suite">
<directory>./MyCompany/Service</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="./log/codeCoverage" charset="UTF-8"
yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"
showUncoveredFiles="false" />
@jackdpeterson
jackdpeterson / test-oauth.html
Created April 22, 2016 17:33
Apigility login using jQuery
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Oauth test</title>
<script src="../js/jquery.js"></script>
<!-- Latest compiled and minified CSS -->
@jackdpeterson
jackdpeterson / 042-vagrant.binary
Created June 8, 2016 16:30
042-vagrant.binary - switch username to vagrant
#!/bin/bash -eux
# vi: ts=4 noexpandtab
#
# Generate a generic Vagrant Box.
#
# Vagrant images are essentially nothing more than OVA's with extra-metadata.
#
# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the instance.
# This build step creates a cloud-config ISO so that Cloud-Init will configure
# the initial user, creates meta-data that tells Vagrant how to interact with
@jackdpeterson
jackdpeterson / convert_raw_to_jpeg.sh
Last active January 8, 2019 04:35
bash script to recursively convert RAW to JPEG retaining directory structure.
#!/bin/bash
src_dir=$1
src_dir_length=${#src_dir}
dest_dir=$2
file_type="ARW"
### let's use ufraw-batch. This assumes that you've compiled to the latest ... 0.22 as of this one doesn't cause crappy weirdness with red-spots appearing with under-exposure.
# Usage: ./convert_raw_to_jpeg.sh /source/folder /destination/folder
#
###
@jackdpeterson
jackdpeterson / CellularAdapterDisableEnableScript.cmd
Last active January 18, 2018 21:53
Restart Cellular Adapter
### GET WDK for Windows 10: https://developer.microsoft.com/en-us/windows/hardware/windows-driver-kit
## Docs for devcon can be found at https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon
@jackdpeterson
jackdpeterson / Expr.php
Created March 2, 2018 20:46
When you are using the where In SQL-like search and provide an empty array for the in side of things ... DQL will barf and die with a syntax error. The fix is to check the count of items in the parameter being passed in and create a single entry with a non-possible value to filter down. /** * Creates an IN() expression with the given arguments. …
/**
* Creates an IN() expression with the given arguments.
*
* @param string $x Field in string format to be restricted by IN() function.
* @param mixed $y Argument to be used in IN() function.
*
* @return Expr\Func
*/
public function in($x, $y)
{
@jackdpeterson
jackdpeterson / FacebookAction.php
Created March 6, 2018 21:35
League OAuth2 OpenID (kind-of) with FaceBook Authorization Code flow to internal Authorization Code grant
<?php
namespace Sso\Action;
use League\OAuth2\Client\Provider\Facebook;
use League\OAuth2\Client\Provider\FacebookUser;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;