Skip to content

Instantly share code, notes, and snippets.

David Lundgren dlundgren

Block or report user

Report or block dlundgren

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dlundgren
dlundgren / zabbix-slack.php
Last active Mar 21, 2019
Slackify the Zabbix alerts
View zabbix-slack.php
#!/usr/bin/env php
<?php
/**
* Slackify Zabbix Alerts
*
* @copyright 2019, David Lundgren <dlundgren@syberisle.net>
* @license MIT
*/
function get_key($argv, $pos, $shopts, $lopts)
{
@dlundgren
dlundgren / manual-gs-9.25.yml
Created Dec 7, 2018
ghostscript 9.25 on Ubuntu 16.04
View manual-gs-9.25.yml
---
- hosts: all
gather_facts: no
become: yes
vars:
packages_manual:
- libgs9-common_9.25~dfsg+1-0ubuntu0.16.04.3_all.deb
- libgs9_9.25~dfsg+1-0ubuntu0.16.04.3_amd64.deb
- ghostscript_9.25~dfsg+1-0ubuntu0.16.04.3_amd64.deb
tasks:
@dlundgren
dlundgren / ContextResolver.php
Last active Dec 20, 2017
Contextual Resolver for Aura.DI
View ContextResolver.php
<?php
/**
*
* This file is part of Aura for PHP.
*
* @license http://opensource.org/licenses/MIT MIT
*
*/
use Aura\Di\Resolver\Resolver;
View IsStaticProxy.php
<?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 / 0_reuse_code.js
Created Jan 24, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View thoughtful_array_diff.php
<?php
/**
* Similar to array_diff() but works with the base multidimensional arrays
*
* @params array ...
* @return array
*/
function arrayDiff()
{
$arys = func_get_args();
@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
*
You can’t perform that action at this time.