Skip to content

Instantly share code, notes, and snippets.

View dlundgren's full-sized avatar

David Lundgren dlundgren

View GitHub Profile
@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}
@dlundgren
dlundgren / change-user-pass.php
Last active October 6, 2016 17:12
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));
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 / 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
*
@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 / 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 / mailhog.conf
Created May 9, 2016 13:40
vagrant+ansible mailhog php setup
description "Mailhog"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
pre-start script
exec su - vagrant -c "/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &"
end script
@dlundgren
dlundgren / UrlFor.php
Created March 24, 2016 21:31
Foil extension to handle route generation in the views
<?php
namespace Application\View\Extension;
use Aura\Router\Router;
use Foil\Contracts\ExtensionInterface;
class UrlFor
implements ExtensionInterface
{
/**
@dlundgren
dlundgren / MemoryFile.php
Last active February 15, 2017 16:00
Emulated file stream that is Unicode aware
<?php
namespace Feral;
/**
* Represents the given contents as a file.
*
* Uses the php://memory system to handle this
*
* @package Feral
*/
@dlundgren
dlundgren / divi-sticky-footer.css
Last active February 18, 2016 18:10
Divi sticky footer (change the margin's appropriately)