Skip to content

Instantly share code, notes, and snippets.

@karussell
karussell / copy-to-bashrc.sh
Last active June 10, 2020 20:36
append to foreign pull request
# Here is how to append commits to a pull request from a foreign repository without (slow) cloning
# When you put the function in .bashrc you can use it via:
# cd graphhopper # go into your local copy of the repo where the pull request was made
# pranch graphhopper msbarry:sample-and-3d-simplify
# The first argument is your organisation and the second argument is "foreign_organisation:foreign_branch" e.g. copied from the pull request
pranch()
{
forbranch=${2#*:} # == foreign branch
fororg=${2%%:*} # == foreign organisation
locbranch=${fororg}_${forbranch}
@karussell
karussell / price.md
Last active March 14, 2024 10:18
hetzner pricing for 256GB RAM servers and beyond
name CPU 256GB-price max GB max-price price/1GB CPU Passmark Benchmark
SB (auction) Xeon® E5-1650 v3 Hexa-Core ~60€ 256 ~60€ 0.23 10413 (single: 2123)
SB (auction) Xeon W-2145 8-Core ~100€ 256 ~100€ 0.39 18057 (single: 2610)
AX161 EPYC™ 7502P 32-Core Zen2 267€ 1024 727€ 0.71-1.04 48995 (single: 1894)
AX162-R EPYC™ 9454P 48-Core Zen4 249€ 1152 663€ 0.58-0.97 96088 (single: 2979)
PX93 Xeon W-2295 18-Core 267€ 512 463€ 0.9 -1.04 31484 (single: 2673)
DX152 2*Xeon SP Silver 10-Core 268€ 768 492€ 0.640-1.07 19256*2
DX153 2*Xeon Silver 4410Y 12-Core 405€ 1024 73
# Specify a vehicle (FlagEncoder) or another custom profile like
base: car
# in meter
vehicle_height: 3.8
vehicle_width: 2.5
# in tons
vehicle_weight: 4.5
# The formula is defined in CustomWeighting, where the speed_factor can be used to increase and decrease speed.
@karussell
karussell / request.json
Last active February 10, 2020 09:19
Cluster API
{
"configuration" : {
"routing" : {
"profile" : "car"
},
"clustering" : {
"max_quantity" : 10,
"min_quantity" : 5,
"num_clusters" : 5
}
@karussell
karussell / error.txt
Created January 30, 2020 16:45
graal native image
[hello.helloworld:8352] compile: 31,630.85 ms, 2.08 GB
Fatal error: java.lang.UnsatisfiedLinkError
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:456)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:357)
diff --git a/core/src/main/java/com/graphhopper/GraphHopper.java b/core/src/main/java/com/graphhopper/GraphHopper.java
index 673b1880c..6207e5f26 100644
--- a/core/src/main/java/com/graphhopper/GraphHopper.java
+++ b/core/src/main/java/com/graphhopper/GraphHopper.java
@@ -82,7 +82,7 @@ public class GraphHopper implements GraphHopperAPI {
private final String fileLockName = "gh.lock";
private final Set<RoutingAlgorithmFactoryDecorator> algoDecorators = new LinkedHashSet<>();
// utils
- private final TranslationMap trMap = new TranslationMap().doImport();
+ private final TranslationMap trMap;
@karussell
karussell / test.geojson
Last active November 5, 2019 20:20
test geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
public int removeAllOlderThan(int batchSize, DateTime date) {
try (Connection c = dc.getConnection()) {
PreparedStatement s1 = c.prepareStatement(String.format("SELECT %s FROM %s WHERE created_at < ?",
KEY, dc.getTableName(tableName)));
s1.setLong(1, date.getMillis());
ResultSet rs = s1.executeQuery();
List<String> list = new ArrayList<>(batchSize);
PreparedStatement s2 = null;
int executeUpdateCount = 0;
while (true) {
@karussell
karussell / an_idea_for_vehicle_profiles.md
Last active November 1, 2019 08:08
vehicle profile config

Loose statements

properties: compact, self-explanatory, declarative "no-loop", native yaml (?)

very specific to influence only the cost and time calculation:

calcMillis:
  time = distance_in_m / speed_in_kmh * 3.6 + delay_in_sec + turn_cost_delay_in_sec
calcWeight:
 if (isInfinity(time)) return infinity
@karussell
karussell / MyBenchmark.java
Created July 24, 2019 16:20
small benchmark
/*
* Copyright (c) 2014, Oracle America, Inc.
* 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.
*