Skip to content

Instantly share code, notes, and snippets.

View Pyknic's full-sized avatar

Emil Forslund Pyknic

View GitHub Profile
@Pyknic
Pyknic / Collision.cs
Created June 23, 2021 14:04
Lightweight collision and intersection system for SFML.
// Copyright (c) 2021 Emil Forslund
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
@Pyknic
Pyknic / apalike-bilingual.bst
Created May 31, 2021 06:30
LaTeX bibliography style that looks like the APA Style but allows \harvardand to be overriden
% BibTeX `apalike' bibliography style (version 0.99a, 8-Dec-10), adapted from
% the `alpha' style, version 0.99a; for BibTeX version 0.99a.
%
% Copyright (C) 1988, 2010 Oren Patashnik.
% Unlimited copying and redistribution of this file are permitted as long as
% it is unmodified. Modifications (and redistribution of modified versions)
% are also permitted, but only if the resulting file is renamed.
%
% Differences between this style and `alpha' are generally heralded by a `%'.
% The file btxbst.doc has the documentation for alpha.bst.
@Pyknic
Pyknic / Collision.cs
Created May 26, 2021 10:49
Lightweight single-file collision/intersection-library for SFML.Net
// Copyright (c) 2021 Emil Forslund
//
// 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:
//
// The above copyright notice and this permission notice shall be included in
public struct Rect {
public Vector3 TopLeft, BottomRight;
public bool Intersects(Rect other) {
return !( this.TopLeft.X > other.BottomRight.X
|| this.TopLeft.Y > other.BottomRight.Y
|| this.TopLeft.Z > other.BottomRight.Z
|| this.BottomRight.X < other.TopLeft.X
|| this.BottomRight.Y < other.TopLeft.Y
|| this.BottomRight.Z < other.TopLeft.Z);
@Pyknic
Pyknic / discrete.cpp
Created September 11, 2019 19:03
C++ Discretization
//
// Copyright (c) 2019 Emil Forslund. All rights reserved.
//
#include "discrete.hpp"
Discrete::Discrete(float min, float, max, uint16_t buckets) :
min{min},
discreteFactor{buckets / (max - min)},
continuousFactor{(max - min) / buckets},
function AssertSize(name, matrix, sizes)
if ~isequal(size(matrix), sizes)
error('Expected %s to have size %s, but was %s.', name, mat2str(sizes), mat2str(size(matrix)));
end
end
@Pyknic
Pyknic / hopfield.m
Created September 6, 2018 15:13
MatLab function for correcting errors in input matrices using Hopfield Networks
# hopfield(input, patterns)
#
# Usage Example:
# hopfield([0 0 0;0 0 0;1 1 1], {[1 1 1;0 0 0;0 0 0],[0 0 1;0 0 1; 1 1 1]})
# ans =
# 0 0 1
# 0 0 1
# 1 1 1
#
# Arguments:
package com.speedment.extra.slf4j;
import com.speedment.common.logger.*;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static java.lang.String.format;
import static java.util.Collections.newSetFromMap;
import static java.util.Objects.requireNonNull;
package com.speedment.enterprise.benchmark.joins;
import com.speedment.common.tuple.Tuple2;
import com.speedment.common.tuple.Tuples;
import com.speedment.enterprise.aggregator.Aggregator;
import com.speedment.enterprise.benchmark.joins.db.EmployeesApplication;
import com.speedment.enterprise.benchmark.joins.db.EmployeesApplicationBuilder;
import com.speedment.enterprise.benchmark.joins.db.employees.Employee;
import com.speedment.enterprise.benchmark.joins.db.salaries.Salary;
import com.speedment.enterprise.benchmark.joins.db.salaries.SalaryManager;
@Pyknic
Pyknic / result.csv
Created January 17, 2018 18:36
Statistikuppgift
297838327 katjanouch 22640 34121 1577 50678 79 1305267438000
1867640504 JagHubbot 6887 227 200 25139 106 1379249825000
938086706988961793 hallonstenarna 507 12 90 242 47 1512492274000
870383574586990593 Plattifnatt 30 20 134 923 74 1496350589000
3440810895 Pergite_Pie 3013 1363 3654 45550 42 1440543574000
797540786715918336 linda_guarneri 7493 745 1694 4231 9 1478983515000
3082915895 jonsson_goran 43533 173 155 31406 26 1425949836000
515667925 LindemannUlrika 16348 369 665 27010 115 1330967869000
938558795780894720 Andreas31469212 0 0 0 3 3 1512604829000
2954692619 NSkaver 50269 1873 4458 75043 78 1420114146000