Skip to content

Instantly share code, notes, and snippets.

Top picks from StrangeLoop 2016

These are the presentations, which I did like most (and had a chance to watch). Order matters:

  • Idealized commit logs - the best talk IMO. Andrew Shreve shows his approach to better understanding of programs by using technique called program slicing - the idea is to decompose program and its tests in way that every 'commit' contains the smallest part of the code that makes included test pass. This way you get a history of program, which aims at incremental development of understanding. Awesome stuff. https://www.youtube.com/watch?v=dSqLt8BgbRQ&index=4&list=PLcGKfGEEONaDvuLDFFKRfzbsaBuVVXdYa

  • Clojure spec - the technique that is built into the language, allowing you to express the constraints over values as a part of function signature definition. Having those, you are able to validate, auto-document and auto-test (genertively) code. While its not a super innovative idea - it's interesting to see something like this to be implemented as a part of the language (i

Craft Conference writeup:

  • Wonderful keynote by Dan North about being aware of uncertainity: https://vimeo.com/43603453
  • It was pretty unfortunate, but Kyle Kingsbury couldn't make it to the conference, but he managed to record a video for Jepsen V: https://www.youtube.com/watch?v=IcsocrEz9wE&feature=youtu.be (didn't manage to see it yet)
  • Adam Tornhill showing outcomes of his static code analysis over large codebases https://www.youtube.com/watch?v=TfZmuS01CNs . Though I've already seen this presentation, I again started to wonder what would have happened if we would apply it on our codebase. I do disagree with him in terms of copy and paste though (its not that straightforward in terms of microservices)
  • http://beta.craft-conf.com/speaker/RachelDavies Rachel has proven to me that XP is still up there in some companies, but some of its practices I still consider unfounded - still there was a nice term of emerge of "Full Spectrum Developer" - person that is not only doing development, but also tak
@kubek2k
kubek2k / log.xml
Created February 8, 2016 12:56
Copy this, go to livetemplates, select "other" and paste
<template name="log" value="private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger($CLASS_NAME$.class);" description="Creates slf4j logger" toReformat="false" toShortenFQNames="true">
<variable name="CLASS_NAME" expression="className()" defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
@kubek2k
kubek2k / gist:86effe7ac6943dd4f2aa
Created January 4, 2016 09:55
Get all AWS users with their access keys
aws iam list-users | jq '.Users[].UserName' | xargs -n1 -J % aws iam list-access-keys --user-name % | jq '.AccessKeyMetadata[].AccessKeyId + ":" + .AccessKeyMetadata[].UserName'
@kubek2k
kubek2k / get_all_repos_urls.sh
Last active October 20, 2015 10:04
Get all repositories for a given organization in GH or GHE
#!/bin/bash
curl -u $GITHUB_USER:$GITHUB_TOKEN https://$GITHUB_HOST/api/v3/users/$GITHUB_ORG/repos?per_page=1000 | json -a 'ssh_url'
@kubek2k
kubek2k / MapMatcher.java
Created May 25, 2015 08:21
Handy hamcrest map matcher
public static class MapMatcher<K, V> extends TypeSafeMatcher<Map<K, V>> {
private final Map<K, V> desiredContents = new HashMap<>();
@Override
protected boolean matchesSafely(final Map<K, V> item) {
for(final Map.Entry<K, V> kvEntry : this.desiredContents.entrySet()) {
if (!kvEntry.getValue().equals(item.get(kvEntry.getKey()))) {
return false;
}
var http = require('http');
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
@kubek2k
kubek2k / get_on_call_calendar.py
Last active February 8, 2016 13:07
Gets on call calendar from PagerDuty
import urllib2
import urllib
import sys
import os
import json
import datetime
from pytz import timezone
FROM_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
TO_FORMAT = "%Y-%m-%d %H:%M"
@kubek2k
kubek2k / gist:10558929
Created April 12, 2014 21:59
Primes in haskell
module Main where
primes = 1:(nextPrime 2 [])
divisibleByAny x numbers = any (\n -> (rem x n) == 0) numbers
nextPrime start primesSoFar = let
nextP = head (dropWhile (\x -> divisibleByAny x primesSoFar) [start..])
in
nextP:(nextPrime (nextP + 1) (nextP:primesSoFar))
@kubek2k
kubek2k / gist:10368672
Created April 10, 2014 11:02
Context manager example
class X:
def __enter__(self):
print "entering"
def __exit__(self, exception_type, exception_val, trace):
print "exiting"
def restart():
return X()