Skip to content

Instantly share code, notes, and snippets.

View JefClaes's full-sized avatar

Jef Claes JefClaes

View GitHub Profile
@JefClaes
JefClaes / compare.sh
Last active August 18, 2020 13:33
Compare image versions between kubernetes contexts
CONTEXTS=("a" "b" "c")
FILES=()
for CTX in ${CONTEXTS[@]}; do
kubectl config use-context $CTX
FN="$CTX.txt"
kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq > $FN
FILES+=("$FN")
done
@JefClaes
JefClaes / fast_projectionts.fsx
Last active July 30, 2017 12:14
Fast projections
open System
open System.Collections.Generic
let consoleColor (fc : ConsoleColor) =
let current = Console.ForegroundColor
Console.ForegroundColor <- fc
{ new IDisposable with
member x.Dispose() = Console.ForegroundColor <- current }
let cprintf color str = Printf.kprintf (fun s -> use c = consoleColor color in printf "%s" s) str
@JefClaes
JefClaes / gist:c25e90d01b5a376e4e0a
Last active April 26, 2017 20:56
Force create LocalDB database
using (var conn = new SqlConnection(@"Data Source=(LocalDb)\v11.0;Initial Catalog=Master;Integrated Security=True"))
{
conn.Open();
var cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = string.Format(@"
IF EXISTS(SELECT * FROM sys.databases WHERE name='{0}')
BEGIN
ALTER DATABASE [{0}]
@JefClaes
JefClaes / dddeu.md
Created December 2, 2016 22:34
DDDEU

The Breakers

When we design a model, we unwittingly imbue it with our own naïve view of the world. Once it makes its way to the unforgiving real world, we learn that not everyone shares that view. Then your infant model will actively be put to the test. Breakers will scan the model surface for cracks, trying to poke holes in its core properties, finding a way to abuse the assumptions of its creator.

In this series of tales, I'll take you on a journey, visiting various (broken) models at work in the casino world (and in yours), uncovering their weaknesses and possible remedies.

Each time we find ourselves on unknown territory - your core domain, we put ourselves at risk. How do you foster an environment, where a healthy dose of paranoia and misanthropy, ensures that you build a strong enough defense mechanism, keeping those that are up to no good, at bay?

@JefClaes
JefClaes / gist:0cfed3f0ad26a75eda1e
Created October 5, 2014 13:05
Event Store PackageFramingException: Package size is out of bounds
[07,09:57:30.489,ERROR] TcpPackageConnection: [127.0.0.1:1113, L127.0.0.1:55697, {d9265236-f72b-4418-a470-780ab7ef2af9}]. Invalid TCP frame received.
EXCEPTION(S) OCCURRED:
EventStore.ClientAPI.Transport.Tcp.PackageFramingException: Package size is out of bounds: 186992564 (max: 67108864).
at EventStore.ClientAPI.Transport.Tcp.LengthPrefixMessageFramer.Parse(ArraySegment`1 bytes)
at EventStore.ClientAPI.Transport.Tcp.LengthPrefixMessageFramer.UnFrameData(IEnumerable`1 data)
at EventStore.ClientAPI.Transport.Tcp.TcpPackageConnection.OnRawDataReceived(ITcpConnection connection, IEnumerable`1 data)
@JefClaes
JefClaes / gist:8324613
Created January 8, 2014 21:03
Top 3 fiction 2013
1. http://www.amazon.co.uk/Solitude-Thomas-Cave-Georgina-Harding/dp/0747599742/ref=sr_1_1?ie=UTF8&qid=1389214927&sr=8-1&keywords=the+solitude+of+thomas+cave
2. http://www.amazon.co.uk/Walk-Wild-Side-Nelson-Algren/dp/1841956805/ref=sr_1_1?ie=UTF8&qid=1389214888&sr=8-1&keywords=A+walk+on+the+wild+side
3. http://www.amazon.co.uk/Cities-Plain-Boder-Trilogy-Border/dp/0330511203/ref=sr_1_1?ie=UTF8&qid=1389214902&sr=8-1&keywords=cities+of+the+plain
@JefClaes
JefClaes / gist:8174136
Created December 29, 2013 19:56
Failing ES projection
fromAll().when({
$init: function () {
return { };
},
$any: function(state, event) {
var eventType = event.eventType;
if (state.hasOwnProperty(eventType)) {
state[eventType] += 1;
} else {
state[eventType] = 1;
@JefClaes
JefClaes / gist:7783803
Created December 4, 2013 07:56
Hopefully you will not lose power too often.
We are told that the flush and fsync primitives are broken on some versions of Windows and Linux. This is unfortunate. It opens SQLite up to the possibility of database corruption following a power loss in the middle of a commit. However, there is nothing that SQLite can do to test for or remedy the situation. SQLite assumes that the operating system that it is running on works as advertised. If that is not quite the case, well then hopefully you will not lose power too often.
Source: http://www.sqlite.org/atomiccommit.html
@JefClaes
JefClaes / gist:7428657
Created November 12, 2013 10:22
Can you guess which country this is about?
What happened here was the gradual habituation of the people, little by little, to being governed by surprise; to receiving decisions deliberated in secret; to believing that the situation was so complicated that the government had to act on information which the people could not understand, or so dangerous that, even if the people could not understand it, it could not be released because of national security.
@JefClaes
JefClaes / gist:6864840
Created October 7, 2013 09:07
Constants and comments add so much value, couldn't live without them
public class Constants
{
/// <summary>
/// String containing the value "normal"
/// </summary>
public const string NORMAL_FOLDER = "normal";
/// <summary>
/// String containing the value "backup"
/// </summary>