Skip to content

Instantly share code, notes, and snippets.

@daviddyball
daviddyball / keybase.md
Created April 26, 2021 14:27
keybase.md

Keybase proof

I hereby claim:

  • I am daviddyball on github.
  • I am daviddyball (https://keybase.io/daviddyball) on keybase.
  • I have a public key whose fingerprint is CEE0 D886 CEAD 3EC8 0DDA 10AD 2433 FD5A 7F52 2F85

To claim this, I am signing this object:

@daviddyball
daviddyball / controller.go
Created September 19, 2018 10:39
Kubebuilder Finalizer Attempt
func (r *MyReconciler) Reconcile(request reconcile.Request) (reconcile.Result, error) {
instance := &v1beta1.MyInstance{}
err := r.Get(context.TODO(), request.NamespacedName, instance)
if err != nil {
if errors.IsNotFound(err) {
// Object not found, return
return reconcile.Result{}, nil
}
return reconcile.Result{}, err
}

Keybase proof

I hereby claim:

  • I am daviddyball on github.
  • I am daviddyball (https://keybase.io/daviddyball) on keybase.
  • I have a public key whose fingerprint is 691A 9E57 BB42 6F6E FD28 B1D7 9CB6 139C B63B 5013

To claim this, I am signing this object:

I hereby claim:

  • I am daviddyball on github.
  • I am daviddyball (https://keybase.io/daviddyball) on keybase.
  • I have a public key ASAzffbiYCYlY3cKbAVnxkh59DUA5ow5QraY56my4vimLQo

To claim this, I am signing this object:

{
docker network create --driver overlay test-net
docker service create --name test-server \
--publish 80:80 \
--replicas 1 \
--network test-net \
debian:latest \
/bin/bash -lc "apt-get update && apt-get install -y netcat && echo test > /tmp/page.html; while true; do nc -l 80 < /tmp/page.html; done"
docker service create --name test-consumer \
@daviddyball
daviddyball / collaborative_query.sql
Last active December 23, 2021 21:26
Song Recommendations using Neo4J and Collaborative Filtering
// Example Query
PROFILE
MATCH (user:User {id: 2})-[:LIKES]->(liked_song)<-[:LIKES]-(similar_user)-[:LIKES]->(recommendation)
WITH similar_user, COUNT(similar_user) as similar_user_rating, user
ORDER BY similar_user_rating
LIMIT 50
MATCH (similar_user)-[:LIKES]->(recommendation)
WHERE user<>similar_user AND
import os
from invoke import run
from jinja2 import Template
class TemplateError(Exception):
pass
#!/usr/bin/python2
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@daviddyball
daviddyball / docker.yml
Created June 24, 2015 17:48
docker play for custom registry
- docker:
name: my-container
image: my-image:latest
registry: https://my-private-repo:443/v2/
detach: true
command: bash -lc "while true; do sleep 1; done"
@daviddyball
daviddyball / common.py
Created June 22, 2015 18:07
Usefull filters for ansible
def split_string(*a, *kwargs):
return split(a[1],a[0])
class FilterModule(object):
def filters(self):
return {
'split_string': split_string
}