Skip to content

Instantly share code, notes, and snippets.

View davidkuster's full-sized avatar

David Kuster davidkuster

View GitHub Profile
@davidkuster
davidkuster / git-statistics.sh
Created October 27, 2023 16:28
Script to report stats on a Git project. Who's been working nights and weekends? (Spoiler alert: this guy)
#!/bin/bash
# Pass project dir as a param (could be '.' for the current dir)
cd $1
if [ ! -d .git ]; then
echo "This is not a valid git directory."
exit 1
fi
@davidkuster
davidkuster / Default (OSX).sublime-keymap
Last active August 31, 2022 16:38
Sublime Text 3 config
[
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
// shortcuts for home and end keys because of the 6 row lenovo keyboard layout
{ "keys": ["ctrl+,"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+."], "command": "move_to", "args": {"to": "eol", "extend": false} },
// shift shortcuts to select text with home & end shortcuts
{ "keys": ["shift+ctrl+,"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+ctrl+."], "command": "move_to", "args": {"to": "eol", "extend": true} },
package tbd;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List;
@davidkuster
davidkuster / PropertyLogger.java
Last active July 17, 2020 03:23 — forked from sandor-nemeth/PropertyLogger.java
Spring Boot - Log all configuration properties on application startup
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Profile;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.AbstractEnvironment;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.stereotype.Component;
@davidkuster
davidkuster / New-Mac-setup.md
Last active August 10, 2022 19:46
New Mac setup notes

Mac setup

System prefs

  • upper left corner hot corner turns on screensaver
  • single press for a click
  • turn off scroll direction natural
  • speed up key repeat
  • Keyboard - text
  • turn off correct spelling automatically, capitalize words automatically, touch bar typing suggestions, use smart quotes and dashes
@davidkuster
davidkuster / mk-start
Created May 17, 2018 04:51
Script to start Minikube
#!/bin/bash
#minikube start --vm-driver=xhyve
minikube start --memory=8000 --vm-driver=xhyve --container-runtime=docker --v=3 --v=10 --alsologtostderr --insecure-registry="docker...io:5000"
kubectl cluster-info
@davidkuster
davidkuster / gist:f485e7675cf56ad95b9ffe18d4511279
Created July 18, 2017 18:59
Quick FizzBuzz implementations
// corrected from initial approach, using % 15. My first attempt was wrong. This is what I get for not writing tests. Although tests on println...hmm...
def fizzBuzz = {
for (int x=1; x <= 100; x++) {
if (x % (15) == 0) println "FizzBuzz"
else if (x % 3 == 0) println "Fizz"
else if (x % 5 == 0) println "Buzz"
else println x
}
}
@davidkuster
davidkuster / GroovyREPL.py
Last active May 12, 2016 17:55
Start of a Sublime Text 2 plugin to use Sublime instead of a browser-based code editor as the front end for a Groovy REPL
import json
import sublime
import sublime_plugin
import threading
import urllib
import urllib2
# Sublime plugin to use Groovy REPL functionality as offered by a Spring Boot
# app with the necessary server-side support.
#
@davidkuster
davidkuster / grab.groovy
Created March 18, 2016 19:53
Grape Grab from Groovy console
groovy.grape.Grape.grab(group:'org.springframework', module:'spring-web', version:'4.2.5.RELEASE')
import org.springframework.web.util.UriComponentsBuilder
@davidkuster
davidkuster / ClassUtils.groovy
Created December 28, 2015 17:32
Util to get the fields defined on a class, as well as converting objects to maps
// TODO: think about whether this makes more sense as a trait...
class ClassUtils {
// exclude all fields that start with these prefixes from the list returned by getFields() method
private static final List<String> EXCLUDED_FIELD_PREFIXES = ['grails_', '$', '__']
// Added exclusion of "grails_" and "$" fields - causes problems with Validateable cmd objs.
// Added exclusion of "__" due to Cobertura adding "__cobertura_counters" field.
/**