Skip to content

Instantly share code, notes, and snippets.

View timClicks's full-sized avatar
🏠
Working from home

Tim Clicks timClicks

🏠
Working from home
View GitHub Profile
@NiclasEriksen
NiclasEriksen / main.py
Created February 16, 2020 15:16
Recursive line geometry
from vector import Vector
from math import pi
from PIL import Image, ImageDraw, ImageColor
import random
WIDTH = 1448 # Final image will be twice this, resolution low
HEIGHT = 1024 # for performance reasons (this also leaves some artifacts)
SS = 8 # Supersampling, for anti-aliasing
THICKNESS = 1 # Line thickness
RECURSION_LIMIT = 100 # Just for safety
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {

Notes on how I organise StatisticsNZ CSVs

This write-up details how I re-structure and organise StatisticsNZ CSVs. It makes no mention of how I handle particular data values and codes (e.g. datetimes, missing and confidential values). My practice changes a little between projects, but typically I end up with a structure along the following lines:

  • I remove all footnotes and metadata.
  • I separate data measured at different scales into different CSVs (e.g. meshblock data goes in a different file from area units).
  • I remove all total rows.
  • I rename all columns with concise but meaningful shortnames so they are easier refer to in code.
  • I generate a JSON file containing key metadata and mappings between my shortnames and the original long fieldnames.

[JULIA] Faster than CGAL Delaunay

TL;DR

DelaunayJL is an incremental 2D Delaunay triangulation algorithm implemented in Julia, it is robust and ~20% faster than CGAL, the C++ de-facto industry standard. And it's MIT Licensed! all links to code are below

Show me the data!

The figure below shows how much time it takes to run a benchmark on my computer, an Intel Core i7-4800MQ CPU @ 2.7Ghz, 16GB RAM, Win8 64bit. The benchmark consists of inserting a number of points uniformly distributed. The benchmark is run 5 times for each number of points once for CGAL and once for Julia. The numbers of points used are 10K, 100K, 1M, and 10M. CGAL v4.4 was compiled with VS2013 64bit release mode, Julia is of version 0.3.0 Commit 7681878 (2014-08-20 20:43 UTC) x86_64-w64-mingw32 the delaunay code is here (see other gists of mine for complementing files... I'll compile this all into a library when I have the time)

import java.util.Map;
import java.util.Comparator;
import java.util.Collections;
int index = 0;
PImage pokemon, current;
PGraphics pie;
HashMap<Integer,Integer> colorMap;
ArrayList<Integer> colorByCount;
@planbnet
planbnet / gnome-terminal-zenburn.sh
Created December 2, 2011 09:12
Zenburn color scheme for gnome-terminal
#!/usr/bin/env bash
dir=$(dirname $0)
gconfdir=/apps/gnome-terminal/profiles
echo # This makes the prompts easier to follow (as do other random echos below)
########################
### Select a profile ###
########################
@denik
denik / ServerRack.py
Created June 5, 2011 09:31
class for managing multiple servers in gevent
# Class for managing multiple servers or anything with start() and stop() methods
class ServerRack(object):
def __init__(self, servers):
self.servers = servers
def start(self):
started = []
try: