Skip to content

Instantly share code, notes, and snippets.

View plombardi89's full-sized avatar
🤔
Darwin. I Ching. Improvise. Adapt.

Philip Lombardi plombardi89

🤔
Darwin. I Ching. Improvise. Adapt.
View GitHub Profile
@plombardi89
plombardi89 / MixinExperiment
Created June 18, 2013 15:49
Attempting to create a mixin function that can mixin multiple classes
# I get an error like the following with this object:
# metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
def mixin(TargetClass, *args, **kwargs):
if kwargs.get('name') is None:
kwargs['name'] = '%s_mixed_with_%s' % (TargetClass.__name__, "".join(map(str, args)))
class MixedClass(TargetClass, *args):
pass
@plombardi89
plombardi89 / GNameGenerator
Created August 25, 2014 02:50
Name Generator
/*
* Copyright 2014 Philip Lombardi
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@plombardi89
plombardi89 / fizzbuzz_recursive.groovy
Created August 29, 2014 01:39
Recursive Fizzbuzz
// Performs the FizzBuzz test using recursion. I intend to use this more often when interviewing job candidates to find out if they
// even have a basic grasp of recursion.
def fizzbuzz(int max) {
fizzbuzz(1, max)
}
def fizzbuzz(int current, int max) {
if (current == max)
return
@plombardi89
plombardi89 / vbox_soap_getting_started.groovy
Created September 5, 2014 01:18
VirtualBox SDK (via SOAP) Example
@GrabResolver(name='clojars.org', root='http://clojars.org/repo')
@Grab('org.clojars.tbatchelli:vboxjws:4.3.4')
import org.virtualbox_4_3.*
// Setup Instructions
// ------------------
//
// Getting setup is a bit of a PITA. I recommend disabling auth for testing purposes. Also in a
// a real development environment I would recommend pulling the vboxjws.jar from VirtualBox
// rather than using the version published on Clojars... why VirtualBox does not publish more
@plombardi89
plombardi89 / LatestVersion.groovy
Created September 5, 2014 02:03
Given a list of versions then determine the latest
def latestVersion(versions) {
def sorted = versions.sort(false) { a, b ->
a = a.split('\\.')
b = b.split('\\.')
// determines how many numbers need to be compared
def commonIndices = Math.min(a.size(), b.size())
// compare each number in a version
@plombardi89
plombardi89 / NamedThreadFactory.groovy
Created September 7, 2014 18:27
NamedThreadFactory in Java and Groovy style
import java.util.concurrent.ThreadFactory
import java.util.concurrent.atomic.AtomicInteger
// --- Java Style ---
class NamedThreadFactory implements ThreadFactory {
private final String prefix
private final AtomicInteger count
#!/usr/bin/env sh
set -e
python_version="python2.7"
q3k_install_root="${HOME}/datawire"
is_python_installed () {
amsg " Checking if python is installed: "
if command -v python > /dev/null 2>&1; then
# rules.toml
################################################################
# Traefik Rules Configuration
################################################################
[frontends]
[frontends.foo]
passHostHeader = true
backend = "foo"
rule = "PathPrefixStrip: /foo"
@plombardi89
plombardi89 / telepresence.log
Created April 9, 2018 20:08
telepresence network crash log
0.0 TL | Telepresence launched at Thu Apr 5 11:54:30 2018
0.0 TL | ['/usr/local/bin/telepresence', '-d', 'mydeployment', '--run', '/bin/sh']
0.1 TL | BEGIN SPAN main.py:408(go)
0.1 TL | Scout info: {'latest_version': '0.78'}
0.1 TL | Context: telepresence-admin-context, namespace: tele-v7, kubectl_command: kubectl
0.1 TL | [1] Capturing: ['kubectl', '--context', 'telepresence-admin-context', 'cluster-info']...
0.9 TL | [1] captured.
0.9 TL | [2] Capturing: ['ssh', '-V']...
1.0 TL | [2] captured.
1.0 TL | [3] Capturing: ['which', 'torsocks']...

Keybase proof

I hereby claim:

  • I am plombardi89 on github.
  • I am plombardi (https://keybase.io/plombardi) on keybase.
  • I have a public key ASA4z3xJ4DpNoEN0ienFF9rgnz2-McPio9XJhlJVuYX9kwo

To claim this, I am signing this object: