Skip to content

Instantly share code, notes, and snippets.

View jandk's full-sized avatar

Jan De Kock jandk

View GitHub Profile
#include <iostream>
double toKelvin(double value, char unit) {
switch (srcUnit) {
case 'C':
return num + 273.16;
case 'F':
return ((num - 32) / 1.8) + 273.16;
case 'K':
return num;
package be.twofold.test;
import java.util.function.*;
public class Main {
public static void main(String[] args) {
int diff61 = testFullRange((a, b) -> compare6(a, b, 1));
int diff63 = testFullRange((a, b) -> compare6(a, b, 3));
int diff41 = testFullRange((a, b) -> compare4(a, b, 1));
@jandk
jandk / Day05.java
Created December 5, 2022 10:16
AOC 2022 Day 5
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Day05 {
public static void main(String[] args) {
String s = Utils.read("day05.txt");
Status status = parse(s);
solve1(status);
solve2(status);
@jandk
jandk / rpn.c
Created January 31, 2012 10:18
Simple RPN calculator in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
typedef struct stack
{
int data;
struct stack *next;
} stack;
@jandk
jandk / ValueOf.java
Last active February 9, 2021 22:16
So don't be lazy, and use value types!
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Objects;
public abstract class ValueOf<T> {
private final T value;
@JsonCreator
protected ValueOf(T value) {
<?php
// Startup database
require_once 'Vacature/Autoloader.php';
Vacature_Autoloader::getInstance();
$mssqlconfig = Vacature_Config::get("db.mssql");
$db = Zend_Db::factory($mssqlconfig);
if (isset($_SESSION['profiler']))
$db->getProfiler()->setEnabled(true);
// Set encoding
@jandk
jandk / keyboard.json
Last active December 23, 2019 16:33
Keyboard layout
{
"keyboard": "kbdfans/kbd67/mkiirgb/v1",
"keymap": "basics",
"layout": "LAYOUT_65_ansi_blocker",
"layers": [
[
"KC_GESC",
"KC_1",
"KC_2",
"KC_3",
@jandk
jandk / pinout.md
Last active October 27, 2019 14:57
Seasonic PSU pinout

Seasonic Prime Ultra Platinum 550

Always looking at connector side, lock on the right. Pin 1, 2 and 3 are defined on the connector by stripes on the side.

24-pin motherboard connector

Standard

| Color | Signal | Pin|Pin | Signal | Color |

@jandk
jandk / jpeg.cs
Created October 14, 2012 21:09
(Almost) JPEG Decoder in C#
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
namespace Jpeg
{
@jandk
jandk / cleanup.sh
Last active December 21, 2018 14:30
Clean up some gentoo files
#!/bin/sh
echo "Space free"
df -h | head -n 2
echo "Removing foreign man pages"
find /usr/share/man -type d -not -name man*
echo "Removing gtk docs"
rm -rf /usr/share/gtk-doc