Skip to content

Instantly share code, notes, and snippets.

View NetzwergX's full-sized avatar

Sebastian Teumert NetzwergX

View GitHub Profile
@NetzwergX
NetzwergX / OptionalExt.java
Created February 13, 2019 19:24
Extension methods for Optional<E> via Manifold
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import manifold.ext.api.Extension;
import manifold.ext.api.This;
/**
* Extends {@link Optional<T>} with two new methods for acquiring values.
*/
@NetzwergX
NetzwergX / latency.txt
Created December 3, 2018 14:54 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@NetzwergX
NetzwergX / .gitattributes
Last active April 24, 2018 13:12
My .gitignore for Java projects
# ignore tests
tests/ export-ignore
@NetzwergX
NetzwergX / com.jme3.terrain.util.HeightBasedAlphaMapGenerator.java
Last active November 24, 2016 14:26
Heightmap based alpha map generator for jME3
/*
* Copyright (c) 2009-2016 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
@NetzwergX
NetzwergX / CoordinateUtil.java
Created August 26, 2016 18:27
Simple utility for jme3 to convert cartesian to spherical coordinates and vice-versa
/*
* Copyright (c) 2016 Sebastian Teumert (<http://teumert.net>)
*
* 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:
*
/*
* written by Sebastian Teumert in 2016.
* Released into Public Domain. No Rights Reserved.
*/
#include "stdafx.h"
#include <string>
#include<map>
#include<vector>
@NetzwergX
NetzwergX / extend-bug.css
Last active December 26, 2015 15:29
LESS :extend Bug
.var {
text-align: right;
}
.foo {
content: "a";
}
.foo:before {
color: green;
}
.foo:before {
@NetzwergX
NetzwergX / wmake.sh
Last active December 16, 2015 18:19
Build script for WoltLab Community Framework (WCF) packages Automagically builds packages that obey the standard package structure.
#!/bin/bash
#
# Build script for WoltLab Community Framework (WCF) packages
# by Sebastian Teumert (http://www.teumert.net, http://github.com/NetzwergX)
# clear
if ls *.tar > /dev/null 2>&1
then
rm *.tar
fi
@NetzwergX
NetzwergX / wcf-sync.sh
Created May 10, 2012 13:03
Pushes contents of WCF repositories to live install
#!/bin/bash
for dir in ~/git/com.woltlab.wcf.*/
do
test -e ${dir}files && cp -r -s --remove-destination ${dir}files/* ./wcf/
test -e ${dir}templates && cp -r -s --remove-destination ${dir}templates/* ./wcf/templates/
test -e ${dir}acptemplates && cp -r -s --remove-destination ${dir}acptemplates/* ./wcf/acp/templates/
done
wcffiles="~/git/WCF/wcfsetup/install/files/"
@NetzwergX
NetzwergX / git-sync.sh
Created May 5, 2012 17:17
Ever needed to keep your forks in sync with their origin? This will help you for your GIT repositories.
#!/bin/sh
#
# GIT Repository update script by Sebastian Teumert
#
# Stashes local changes, checks out specified branch, pulls branch from origin
# and pushes to upstream.
#
# Used to keep forks synced with their origin
#
# When no argument is specified, this script works in pwd, works on the 'master'-