Skip to content

Instantly share code, notes, and snippets.

@kjlubick
kjlubick / InstallingMeld
Last active November 2, 2023 02:49
How to install Meld on Windows and getting it set up with Git
After installing it http://sourceforge.net/projects/meld-installer/
I had to tell git where it was:
git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld\meld.exe”
And that seems to work. Both merging and diffing with “git difftool” or “git mergetool”
from manim import *
LM_MONO = "Latin Modern Mono"
if sys.platform == "win32":
# Windows names this font differently for unknown reasons
LM_MONO = "LM Mono 10"
ROBOTO_MONO = "Roboto Mono"
RED_60 = "#da1e28"
@kjlubick
kjlubick / !pyramid_dice.go
Last active July 16, 2022 15:08
Pyramid Dice Simulation
package main
import (
"fmt"
"math/rand"
"time"
)
func d6(rng *rand.Rand) int {
return rng.Intn(6) + 1
@kjlubick
kjlubick / LICENSE
Last active May 1, 2022 22:26
Exports a THREE.js scene mesh to STL, making it suitable for 3d printing
The MIT License
Copyright © 2010-2016 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@kjlubick
kjlubick / ISMCTS.py
Created September 21, 2015 01:18
An example of Information Set Monte Carlo Tree Search from http://www.aifactory.co.uk/newsletter/2013_01_reduce_burden.htm
# This is a very simple Python 2.7 implementation of the Information Set Monte Carlo Tree Search algorithm.
# The function ISMCTS(rootstate, itermax, verbose = False) is towards the bottom of the code.
# It aims to have the clearest and simplest possible code, and for the sake of clarity, the code
# is orders of magnitude less efficient than it could be made, particularly by using a
# state.GetRandomMove() or state.DoRandomRollout() function.
#
# An example GameState classes for Knockout Whist is included to give some idea of how you
# can write your own GameState to use ISMCTS in your hidden information game.
#
# Written by Peter Cowling, Edward Powley, Daniel Whitehouse (University of York, UK) September 2012 - August 2013.
@kjlubick
kjlubick / j.java
Created February 9, 2015 17:16
Platform independent way to detect if an xls file has a macro using apache poi
//see http://www.rgagnon.com/javadetails/java-detect-if-xls-excel-file-contains-a-macro.html
public void processPOIFSReaderEvent(POIFSReaderEvent event) {
POIFSDocumentPath path = event.getPath();
if (path.length() == 0) {
return;
}
String firstFolder = path.getComponent(0);
if(firstFolder.startsWith("Macro") || firstFolder.startsWith("_VBA")) {
macroDetected = true;
}
@kjlubick
kjlubick / family_fan_chart.js
Last active March 12, 2019 02:21
Family Tree Map
canvas.width = 3000;
canvas.height = 2200;
canvas.style.width = "900px";
const surface = CanvasKit.MakeCanvasSurface(canvas);
if (!surface) {
throw 'Could not make surface';
}
const skcanvas = surface.getCanvas();
const paint = new CanvasKit.SkPaint();
@kjlubick
kjlubick / 1_toContainRegexMatcher.js
Last active September 26, 2018 13:32
Custom matcher for Jasmine - matcher for a list of strings to have (at least) one that matches a given regex.
const toContainRegexMatcher = {
// see https://jasmine.github.io/tutorials/custom_matcher
// for docs on the factory that returns a matcher.
'toContainRegex': function(util, customEqualityTesters) {
return {
'compare': function(actual, regex) {
if (!(regex instanceof RegExp)) {
throw `toContainRegex expects a regex, got ${JSON.stringify(regex)}`;
}
let result = {};
@kjlubick
kjlubick / docker-cleanup-resources.md
Created March 13, 2018 15:12 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@kjlubick
kjlubick / afl-fuzz-help.txt
Created October 28, 2015 16:28
Help text for afl-fuzz
./afl-fuzz [ options ] -- /path/to/fuzzed_app [ ... ]
Required parameters:
-i dir - input directory with test cases
-o dir - output directory for fuzzer findings
Execution control settings:
-f file - location read by the fuzzed program (stdin)