Skip to content

Instantly share code, notes, and snippets.

Avatar

David Lundgren dlundgren

View GitHub Profile
@dlundgren
dlundgren / setup-ezjail.yml
Last active Jan 11, 2021
Sets up ezjail for molecule testing
View setup-ezjail.yml
---
- name: install python
raw: test -e /usr/local/bin/python || (pkg install -y python)
changed_when: False
- name: reload facts
setup:
#
# Instructions for setting up a jail
View ResolveDependencies.php
<?php
namespace Assets;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\AssetReference;
use Assetic\AssetManager;
class ResolveDependencies
{
@dlundgren
dlundgren / generate-cacert
Created Sep 3, 2020
Make Mac OS keychain certs available to Brewed python3
View generate-cacert
#!/bin/sh
CERT_PATH=$(python3 -m certifi)
security find-certificate -a -p /Library/Keychains/System.keychain > ${CERT_PATH}
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> ${CERT_PATH}
@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}