Skip to content

Instantly share code, notes, and snippets.

View dlundgren's full-sized avatar

David Lundgren dlundgren

View GitHub Profile
@dlundgren
dlundgren / MiddlewareStack.php
Created May 18, 2016 20:43
Middleware Stack with PSR-7
<?php
/**
* @file
* Contains \dlundgren\MiddlewareStack\PriorityQueue
*/
namespace dlundgren\MiddlewareStack;
use dlundgren\MiddlewareStack\PriorityQueue;
@dlundgren
dlundgren / check_aad_sync_status.py
Last active September 25, 2019 09:33
Nagios plugin for checking Azure AD Sync status in Office 365
#!/usr/bin/env python
#
# Checks the Azure AD Connect status in Office 365
#
# The user used to check the Azure AD Connect status needs to be an Administrator of some sort
#
# Setup:
# pip install mechanize
#
# Usage:
@dlundgren
dlundgren / abstract-collection.php
Last active August 3, 2016 20:36
SQL Server via PDO
<?php
/**
* @copyright 2015-2016 (c) David Lundgren
* @license MIT <http://opensource.org/licenses/mit-license.php>
*/
namespace SqlServer\Collection;
/**
* Abstract class for representing SQL Server Collections
*
diff --git a/script/spider.py b/script/spider.py
index d8e4c66..66038f9 100644
--- a/script/spider.py
+++ b/script/spider.py
@@ -1,7 +1,7 @@
import argparse
from utils import ip_address, config_file
from packtpub import Packpub
-from upload import Upload, SERVICE_DRIVE, SERVICE_DROPBOX
+#from upload import Upload, SERVICE_DRIVE, SERVICE_DROPBOX
@dlundgren
dlundgren / change-user-pass.php
Last active May 16, 2026 05:59
Change a google user password
<?php
// composer require --no-dev google/apiclient
// composer require --no-dev google/apiclient-services
require_once __DIR__ . '/vendor/autoload.php';
$config = [
// configure stuff here for Google_Client
];
$dir = new Google_Service_Directory(new Google_Client($config));
@dlundgren
dlundgren / google-user-password.php
Created October 6, 2016 22:21
Reseting Google Apps user password
<?php
use Google\Auth\Credentials\ServiceAccountCredentials;
use Google\Auth\Middleware\AuthTokenMiddleware;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
/**
* Class GoogleUserPassword
*
* Follow the instructions at {https://developers.google.com/identity/protocols/OAuth2ServiceAccount?hl=en_US#delegatingauthority}
<?php
/**
* Similar to array_diff() but works with the base multidimensional arrays
*
* @params array ...
* @return array
*/
function arrayDiff()
{
$arys = func_get_args();
@dlundgren
dlundgren / 0_reuse_code.js
Created January 24, 2017 06:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dlundgren
dlundgren / IsStaticProxy.php
Created February 27, 2017 08:30
Static Proxy trait
<?php
/**
* Simple static proxy trait
*
* Aura DI is used for lazy loading
*
* Set `const PROXY_IDENTIFIER = "SomeClass" in your proxy class, and use this trait.
*
* Call `Some\Proxy\SomeClass::register(new SomeClassInstance)` to have it register the alias.
*
@dlundgren
dlundgren / ContextResolver.php
Last active December 20, 2017 03:29
Contextual Resolver for Aura.DI
<?php
/**
*
* This file is part of Aura for PHP.
*
* @license http://opensource.org/licenses/MIT MIT
*
*/
use Aura\Di\Resolver\Resolver;