Skip to content

Instantly share code, notes, and snippets.

Avatar

David Lundgren dlundgren

View GitHub Profile
@dlundgren
dlundgren / google-user-password.php
Created Oct 6, 2016
Reseting Google Apps user password
View google-user-password.php
<?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 Oct 6, 2016
Change a google user password
View change-user-pass.php
<?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));
View packtpub-crawler.diff
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
View abstract-collection.php
<?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 Sep 25, 2019
Nagios plugin for checking Azure AD Sync status in Office 365
View check_aad_sync_status.py
#!/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
Middleware Stack with PSR-7
View MiddlewareStack.php
<?php
/**
* @file
* Contains \dlundgren\MiddlewareStack\PriorityQueue
*/
namespace dlundgren\MiddlewareStack;
use dlundgren\MiddlewareStack\PriorityQueue;
@dlundgren
dlundgren / mailhog.conf
Created May 9, 2016
vagrant+ansible mailhog php setup
View mailhog.conf
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 Mar 24, 2016
Foil extension to handle route generation in the views
View UrlFor.php
<?php
namespace Application\View\Extension;
use Aura\Router\Router;
use Foil\Contracts\ExtensionInterface;
class UrlFor
implements ExtensionInterface
{
/**
@dlundgren
dlundgren / MemoryFile.php
Last active Feb 15, 2017
Emulated file stream that is Unicode aware
View MemoryFile.php
<?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 Feb 18, 2016
Divi sticky footer (change the margin's appropriately)
View divi-sticky-footer.css