Skip to content

Instantly share code, notes, and snippets.

/*
Copyright (c) 2007 Alessandro Warth <[email protected]> and Stephen Murrell <[email protected]>
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
@klucar
klucar / ECEF2LLA.java
Last active March 11, 2025 22:49
Java stubs for converting ECEF (Earth Centered Earth Fixed) coords to Latitude Longitude Altitude
/*
*
* ECEF - Earth Centered Earth Fixed
*
* LLA - Lat Lon Alt
*
* ported from matlab code at
* https://gist.github.com/1536054
* and
* https://gist.github.com/1536056
@jboner
jboner / latency.txt
Last active June 5, 2025 16:44
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
@uhop
uhop / gist:3259255
Created August 4, 2012 18:41
Bezier Shaders & Vector openGL rendering
package doublespark;
import static spark.Spark.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
@willurd
willurd / web-servers.md
Last active June 3, 2025 15:43
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 22, 2025 08:10
A badass list of frontend development resources I collected over time.
@robschmuecker
robschmuecker / README.md
Last active March 28, 2025 14:54
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.

@sonelson
sonelson / Array2DIntgIterator
Created December 24, 2013 19:13
Java implementation to iterate through the elements of a 2 dimensional int array in a clockwise inward spiral starting from the top left cell.
/*
* Array2DIntgIterator implements Iterator interface and provides the functionality
* to iterate through the elements of a 2 dimensional int array in an
* clockwise inward spiral starting from the top left cell.
*
* A [3,4] array of characters with these values:
* 1 2 3 4
* 10 11 l2 5
* 9 8 7 6
* would iterate as:
@Ryan-ZA
Ryan-ZA / 1. StaticFileHandler.java
Last active November 20, 2024 13:00
Simple static fileserver for vert.x - uses cached SHA1 hash etags for client caching to ensure that cached files remain correct after redeploys and between servers.
package com.rc;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.vertx.java.core.AsyncResult;
import org.vertx.java.core.Handler;
import org.vertx.java.core.Vertx;