Skip to content

Instantly share code, notes, and snippets.

David Bazile dbazile

Block or report user

Report or block dbazile

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
@dbazile
dbazile / SpringAdLdapTest.java
Created Mar 18, 2020 — forked from mpilone/SpringAdLdapTest.java
A simple example of using Spring LDAP to authenticate a user against Active Directory.
View SpringAdLdapTest.java
// Setup the LDAP client (normally done via Spring context file).
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl("ldap://adserver.mycompany.com:3268");
contextSource.setBase("DC=AD,DC=MYCOMPANY,DC=COM");
contextSource.setUserDn("readonlyuser@ad.mycompany.com");
contextSource.setPassword("password1");
contextSource.afterPropertiesSet();
LdapTemplate ldapTemplate = new LdapTemplate(contextSource);
ldapTemplate.afterPropertiesSet();
@dbazile
dbazile / ffmpeg.md
Created Dec 29, 2019 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
View ffmpeg.md
@dbazile
dbazile / init.groovy.d-jenkins--configure-globals.groovy
Created Dec 26, 2019
Jenkins initial bootstrapping Groovy scripts.
View init.groovy.d-jenkins--configure-globals.groovy
import jenkins.model.Jenkins
import jenkins.model.JenkinsLocationConfiguration
import hudson.tasks.Mailer
SYSTEM_NAME = 'Jenkins'
SYSTEM_EMAIL = 'jenkins@localhost'
def main() {
@dbazile
dbazile / certgen.py
Created Dec 17, 2019
scripting openssl to generate certificate chains easily
View certgen.py
#!/usr/bin/env python3
import argparse
import datetime
import getpass
import logging
import os
import re
import subprocess
import sys
@dbazile
dbazile / ignore_yaml_tags.py
Created Nov 26, 2019
yaml ignore tags (handy for cloudformation templates)
View ignore_yaml_tags.py
import yaml
yaml.SafeLoader.add_multi_constructor('!', lambda loader, suffix, node: '{0.tag} {0.value}'.format(node))
print(yaml.safe_load('foo: !Ref 1234'))
@dbazile
dbazile / create_cert.sh
Last active Nov 25, 2019
create server SSL certs from CA via openssl
View create_cert.sh
#!/bin/bash
DIR_CERTS='certs'
DN_PREFIX='/C=US/ST=VA/O=ANYCORP/OU=MYPROJ'
FILE_CA_KEY="$DIR_CERTS/ca.key"
FILE_CA_CERT="$DIR_CERTS/ca.pem"
SIZE_KEY=2048
TTL_CA_DAYS=180
TTL_CERT_DAYS=180
View jenkins-install-plugin.sh
#!/bin/bash -e
cd $(dirname $0)
print_green() { printf "\033[32m$*\033[0m\n"; }
print_yellow() { printf "\033[33m$*\033[0m\n"; }
################################################################################
PLUGIN_DIR=${PLUGIN_DIR:=/var/lib/jenkins/plugins}
FILE_OWNER=${FILE_OWNER:=jenkins.jenkins}
@dbazile
dbazile / totp.py
Last active Nov 1, 2019
TOTP Python script
View totp.py
#!/usr/bin/python
"""
totp.py
Simple script to generate time-based OTP (aka "Google Authenticator")
style 2FA token codes.
Reference:
- https://medium.com/@tilaklodha/google-authenticator-and-how-it-works-2933a4ece8c2
- https://github.com/jakwings/bash-totp/blob/14794f6dc91e1a73ae08407f9a3e689c95248ada/totp
@dbazile
dbazile / DtedReader.java
Created Sep 9, 2019
dted reader implementation in Java
View DtedReader.java
package whee;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ShortBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
You can’t perform that action at this time.