Skip to content

Instantly share code, notes, and snippets.

Jan De Kock jandk

Block or report user

Report or block jandk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jandk
jandk / pinout.md
Last active Oct 27, 2019
Seasonic PSU pinout
View pinout.md

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 |

View Poet.kt
import com.squareup.javapoet.*
import java.util.*
import javax.lang.model.element.Modifier
private fun generateIndexOfTriple(typeName: TypeName): List<MethodSpec> {
val arrayTypeName = ArrayTypeName.of(typeName)
val indexOf4 = indexOf4(arrayTypeName, false)
val indexOf2 = indexOf2(arrayTypeName, indexOf4, false)
val lastIndexOf4 = indexOf4(arrayTypeName, true)
val lastIndexOf2 = indexOf2(arrayTypeName, lastIndexOf4, true)
@jandk
jandk / Main.java
Last active Sep 20, 2018
Product ordering
View Main.java
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
public class Main {
private static final AtomicInteger VOLUME = new AtomicInteger(0);
@jandk
jandk / Feistel.java
Last active Sep 27, 2018
Reversible encoding and stringification of numbers
View Feistel.java
package be.tjoener.test;
@SuppressWarnings("PointlessArithmeticExpression")
public final class Feistel {
/**
* Sets the number of rounds, security/speed trade-off
*/
private static final int ROUNDS = 16;
View DemoApplication.java
package com.example.demo;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
View Person.java
public final class Person {
private final String firstName;
private final String lastName;
private Person(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
View EnumsCaseInsensitive.java
@Component
@Order(Ordered.HIGHEST_PRECEDENCE)
@SuppressWarnings({"unchecked", "rawtypes"})
static final class StringToEnumConverterFactory implements ConverterFactory<String, Enum> {
@Override
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) {
return new StringToEnum(getEnumType(targetType));
}
View LargestNumber.java
import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class LargestNumber
{
public static void main(String[] args)
{
String number = IntStream.range(1, 31)
.mapToObj(String::valueOf)
View Misc.cs
using System.IO;
public static class Misc
{
/// <summary>
/// Calculates the checksum on a v0.90 MD superblock.
/// Don't ask me why I needed it.
/// </summary>
/// <param name="filename">
View fix.sh
#!/bin/bash
if [ "$#" -lt 1 ]
then
echo "Usage: fix.sh <folder> [folder]...\n"
exit 1
fi
for d in $@
do
You can’t perform that action at this time.